This plugin provides native CPU instrumentation for monitoring and metrics collection, including: CPU usage and metrics for user, nice, system, idle, iowait, irq, softirq, steal, and guest.
The --proc-path long option is being set as a float instead of a string. The default for this option works fine, but when a user supplied value is passed that value is then converted to a float. The value of config[:proc_path] then becomes 0.0.
Assuming a scenario where you are running the Sensu client as a container with the host /proc/ file system mounted at /rootfs/proc, the following output is the error produced:
/opt/sensu/embedded/bin/check-cpu.rb --proc-path=/rootfs/proc
Check failed to run: No such file or directory @ rb_sysopen - 0.0/stat, ["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-cpu-checks-1.0.0/bin/check-cpu.rb:71:in `initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-cpu-checks-1.0.0/bin/check-cpu.rb:71:in `open'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-cpu-checks-1.0.0/bin/check-cpu.rb:71:in `acquire_cpu_stats'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-cpu-checks-1.0.0/bin/check-cpu.rb:79:in `run'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.4/lib/sensu-plugin/cli.rb:58:in `block in <class:CLI>'"]
In the above output you can see what should be /rootfs/proc/stat is 0.0/stat, because that user input is being converted to a float.
The
--proc-path
long option is being set as a float instead of a string. The default for this option works fine, but when a user supplied value is passed that value is then converted to a float. The value ofconfig[:proc_path]
then becomes0.0
.Assuming a scenario where you are running the Sensu client as a container with the host
/proc/
file system mounted at/rootfs/proc
, the following output is the error produced:In the above output you can see what should be
/rootfs/proc/stat
is0.0/stat
, because that user input is being converted to a float.