sensu-plugins-disk-checks icon indicating copy to clipboard operation
sensu-plugins-disk-checks copied to clipboard

check-disk-usage plugin failing

Open sputturao opened this issue 9 years ago • 20 comments

Tried to use the check-disk-usage plugin and fails.

[root@iabc123def plugins]# /opt/sensu/embedded/bin/ruby check-disk-usage.rb Sensu::Plugin::CLI: ["Not implemented! You should override Sensu::Plugin::CLI#run."] /opt/sensu/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- sys/filesystem (LoadError) from /opt/sensu/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from check-disk-usage.rb:29:in `

'

Before using this plugin, we used to use the old community plugin and that worked without any issue. Old Plugin: https://github.com/sensu/sensu-community-plugins/blob/master/plugins/system/check-disk.rb

[root@iabc123def plugins]# /opt/sensu/embedded/bin/ruby check-disk.rb CheckDisk OK: All disk usage under 85% and inode usage under 85%

sputturao avatar Jan 21 '16 18:01 sputturao

OS is Oracle Linux

sputturao avatar Jan 21 '16 18:01 sputturao

tried to install gem sys-filesystem and still didnt help

/opt/sensu/embedded/bin/ruby check-disk-usage.rb Sensu::Plugin::CLI: ["Not implemented! You should override Sensu::Plugin::CLI#run."] /opt/sensu/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- sys/filesystem (LoadError) from /opt/sensu/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from check-disk-usage.rb:29:in `

'

sputturao avatar Jan 21 '16 20:01 sputturao

+1

axos88 avatar Feb 01 '16 03:02 axos88

+1

willneumob avatar Apr 21 '16 21:04 willneumob

@willneumob @axos88 which OS are you seeing this on?

eheydrick avatar Apr 21 '16 21:04 eheydrick

This is freshly-installed Ubuntu 14.04.3 LTS with ruby and ruby-dev 1.9.1, after a gem install sensu-plugin.

willneumob avatar Apr 21 '16 22:04 willneumob

@willneumob sorry, no idea, that was two months ago. I moved over to the old community plugin.

axos88 avatar Apr 22 '16 12:04 axos88

I will try to repro this. It's working for me on Ubuntu 14.04 using the Sensu embedded Ruby 2.3.

eheydrick avatar Apr 23 '16 21:04 eheydrick

I am facing the same issue as posted by @sputturao I have sensu server and client on same machine and I am using Centos 6 When I run it through command line I am getting the correct output, but when I configured the check in json file I am getting the same above mentioned issue.

Can anyone help me to get out of this?

immusk avatar May 02 '16 08:05 immusk

Hi all, I have exactly same problem mentioned by @immusk did you have any luck on finding a solution? I've tried with require_relative (in the .rb), giving permissions to execute and other things, without success. Thanks in advance if you can help me or post some used resolutions.

agraziolo avatar Jul 06 '16 15:07 agraziolo

I was facing the same issue and here is my solution. I was testing with root and it worked, doing the same as sensu user didn't and gave me the same error as mentioned above. The problem is that when installing the gem, it goes to the root users .gem/ directory You can check where the gem is installed with

/opt/sensu/embedded/bin/gem environment

and you will get something like this

  - INSTALLATION DIRECTORY: /opt/sensu/embedded/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.3.0

you need to install the gem in the INSTALLATION DIRECTORY and not the USER INSTALLATION DIRECTORY.

if you are using ansible to install the gem set user_install=no

    - name: Install sys-filesystem gem
      gem: name=sys-filesystem version=1.1.5 state=present user_install=no executable=/opt/sensu/embedded/bin/gem

lcx avatar Jul 26 '16 13:07 lcx

Is this still an issue?

eheydrick avatar Sep 26 '16 00:09 eheydrick

This is solved when you specify the path of the disk to check. Otherwise it will also check ramdisks etc, and the sensu user has no permissions to do that check.

fkwakkenbos avatar Sep 26 '16 14:09 fkwakkenbos

My apologies for adding to this closed issue, but the above did not help and hopefully this can help others.

Resolved issue by downloading sys-filesystem gem and its runtime dependency (ffi-1.9.18.gem) into following location: /opt/sensu/embedded/lib/ruby/gems/2.3.0.

Ran commands below as sensu user: cd /opt/sensu/embedded/lib/ruby/gems/2.3.0 /opt/sensu/embedded/bin/gem install --local "gems listed above"

Checked /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems and gems are present. Deleted the gem files.

Now this plugin works for me.

valenbb avatar Mar 30 '17 00:03 valenbb

I just did a release: https://github.com/sensu-plugins/sensu-plugins-disk-checks/issues/70 can someone try it and see if the issue is resolved, if not I will start taking a look at this issue.

majormoses avatar May 04 '17 07:05 majormoses

getting these failures randomly after upgrading to 2.1.0...

"Check failed to run: Permission denied - setmntent, [""/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem.rb:301:in mounts'"", ""/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-disk-checks-2.1.0/bin/check-disk-usage.rb:121:in fs_mounts'"", ""/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-disk-checks-2.1.0/bin/check-disk-usage.rb:209:in run'"", ""/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:58:in block in class:CLI'""]",1493906868,,standard,ACTIVE

tkaczerski avatar May 04 '17 14:05 tkaczerski

@tkaczerski sorry to hear, can you give me your full command being run?

majormoses avatar May 04 '17 16:05 majormoses

/opt/sensu/embedded/bin/check-disk-usage.rb -w 86 -c 93

The issue could be: https://github.com/sensu/sensu-omnibus/issues/179

tkaczerski avatar May 04 '17 16:05 tkaczerski

All issues resolved after upgrading glibc.

tkaczerski avatar May 09 '17 18:05 tkaczerski

@tkaczerski thanks I get a 404 so I'm guessing its a private repo. Could you submit a pr to document the requirements?

majormoses avatar May 09 '17 18:05 majormoses