Sh: check-cpu.rb: not found

  1. What have you already tried? Please include links to gists and/or code blocks (if relatively small)

Hi,

in the Sensu Backend I am getting sh: check-cpu.rb: not found .

I have installed the sensu-plugins-cpu-checks asset with the following manifest:

---
type: Asset
api_version: core/v2
metadata:
  name: sensu-plugins-cpu-checks
spec:
  builds:
  - url: https://s1artproxy:PASSWORD@artifactory:8088/artifactory/remote-sensu-assets/24e5a5d7ff0a5e63b0a6902f1224b7d4592cbdc9/sensu-plugins-cpu-checks_4.1.0_centos7_linux_amd64.tar.gz
    sha512: 8a018622018220323588a0d69ce0ee1e8c3ae72ad708108eb105006e1453a507289445eefb222da838b132106abf86910e2226d2148cc90ae64def9e7d887584
    filters:
    - entity.system.os == 'linux'
    - entity.system.arch == 'amd64'
    - entity.system.platform_family == 'rhel'
    - entity.system.platform_version.split('.')[0] == '7'

But I don’t find the check-cpu.rb script on my sensu-agent container. Other plugins install without problems.

The plugin though appears in the plugin list:

sensuctl --namespace sensu-poc asset list

              Name                                                                   URL                                                       Hash    
 ─────────────────────────────── ─────────────────────────────────────────────────────────────────────────────────────────────────────────── ───────── 
  sensu-plugins-cpu-checks        //artifactory/.../sensu-plugins-cpu-checks_4.1.0_alpine3.8_linux_amd64.tar.gz                7a5ad2d  
  sensu-plugins-http              //artifactory/.../sensu-plugins-http_5.1.1_centos_linux_amd64.tar.gz                         642643d  
  sensu-plugins-load-checks       //artifactory/.../sensu-plugins-load-checks_5.0.0_centos_linux_amd64.tar.gz                  0e97bc1  
  sensu-plugins-microsoft-teams   //artifactory/.../sensu-plugins-microsoft-teams_2.0.0-bonsai.0.1_centos_linux_amd64.tar.gz   be8ac9b  
  sensu-ruby-runtime              //artifactory/.../sensu-ruby-runtime_0.0.10_ruby-2.4.4_alpine_linux_amd64.tar.gz             8d768d1

How can I check why my installation of sensu-plugins-cpu-checks is failing?

Best regards,
rforberger

  1. Tell us about your setup, this should include OS, version of Sensu, version of Sensu components (redis, rabbitmq), plugin versions (if applicable), anything special about your setup such as an airgapped network or strict ACLs

OS: RedHat Enterprise Linux 7.7 amd64
running on Kubernetes 1.16.3
Sensu Go Backend Version: Container sensu/sensu-rhel:latest (5.18.1)

  1. Is there a Github issue related to your issue?

Yes, https://github.com/sensu-plugins/sensu-plugins-cpu-checks/issues/76

  1. Is there anything else that can help us effectively help you?

The first thing that stands out to me is that in your sensuctl --namespace sensu-poc asset list output the assets for the cpu-checks and the ruby-runtime have URLs for the apline versions.

Can you provide the output from 'sensuctl --namespace sensu-poc asset info sensu-plugins-cpu-checksandsensuctl --namespace sensu-poc asset info sensu-ruby-runtime`?

Hi @todd,

In the namespace sensu-poc I am using the alpine based sensu container sidecar.
In the namespace ca43-sensu where I am running the sensu-backend, I am using the sensu-rhel container based image.
Here are the command outputs:

=== sensu-plugins-cpu-checks
Name:             sensu-plugins-cpu-checks
Namespace:        sensu-poc
Builds:           
Build:            0
URL:              https://s1artproxy:PASSWORD@artifactory:8088/artifactory/remote-sensu-assets/24e5a5d7ff0a5e63b0a6902f1224b7d4592cbdc9/sensu-plugins-cpu-checks_4.1.0_alpine3.8_linux_amd64.tar.gz
SHA-512 Checksum: 7a5ad2d967d2880076f11dc0ab4abec75dc5f19542a5713cb7694db8f06b186b3834a22dda897797a3dad95ca7e1a8e95cb6b0bc074e416ed6238d861f158071
Filters:          entity.system.os == 'linux', entity.system.arch == 'amd64', entity.system.platform == 'alpine'
=== sensu-ruby-runtime
Name:             sensu-ruby-runtime
Namespace:        sensu-poc
Builds:           
Build:            0
URL:              https://s1artproxy:PASSWORD@artifactory:8088/artifactory/remote-sensu-assets//5123017d3dadf2067fa90fc28275b92e9b586885/sensu-ruby-runtime_0.0.10_ruby-2.4.4_alpine_linux_amd64.tar.gz
SHA-512 Checksum: 8d768d1fba545898a8d09dca603457eb0018ec6829bc5f609a1ea51a2be0c4b2d13e1aa46139ecbb04873449e4c76f463f0bdfbaf2107caf37ab1c8db87d5250
Filters:          entity.system.os == 'linux', entity.system.arch == 'amd64', entity.system.platform == 'alpine', entity.system.platform_version.split('.')[0] == '3'

Can you tell what the problem is?

Thanks.

Best regards,
rforberger

It appears the assets are not being downloaded for some reason. Filters are commonly the case, but these seem okay. Have you tried manually downloading the assets from those URLs via a curl command? And have you checked the logs on the agent container?

Hi @todd,

The asset can be downloaded from our Artifactory using curl.
In the agent container logs I find nothing regarding the cpu check plugin.
But in the backend container logs I find the following positive message:

{"component":"rbac","level":"debug","msg":"request authorized by the binding cluster-admin","time":"2020-03-27T09:04:15Z","zz_request":{"apiGroup":"core","apiVersion":"v2","namespace":"sensu-poc","resource":"assets","resourceName":"sensu-plugins-cpu-checks","username":"admin","verb":"update"}}
{"component":"apid","duration":"1.461ms","level":"info","method":"PUT","msg":"request completed","path":"/api/core/v2/namespaces/sensu-poc/assets/sensu-plugins-cpu-checks","size":0,"status":201,"time":"2020-03-27T09:04:15Z"}

I also see the cpu check plugin in the sensuctl --namespace sensu-poc asset list command.

But my agent container still cannot find the check-cpu.rb script.

Any further ideas?

Best regards,
rforberger

Are the asset definitions in the same namespace as the entity and check?

Hi @todd,

yes, our asset defintions are in the namespace sensu-poc where also the entities and checks reside.

Just our backend is in another namespace called ca43-sensu.

But the problem still exists.

Best regards,
rforberger

Are the other asset based checks and handlers functioning properly?

Hi Todd,
Thanks for your support, the issue is now fixed at our side.

The issue was with the paths specifications of the the runtime assets in the sensu check specification.
The paths did not match according to the installed plugins/assets as per command:
sensuctl asset list --namespace sensu-poc

After matching the paths, events are coming to the sensu backend.

1 Like