sensu-plugins / sensu-plugins-disk-checks

This plugin provides native disk instrumentation for monitoring and metrics collection, including: health, usage, and various metrics.
http://sensu-plugins.io
MIT License
27 stars 63 forks source link

check-disk-usage plugin failing #31

Open sputturao opened 8 years ago

sputturao commented 8 years ago

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 commented 8 years ago

OS is Oracle Linux

sputturao commented 8 years ago

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 `

'

axos88 commented 8 years ago

+1

willneumob commented 8 years ago

+1

eheydrick commented 8 years ago

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

willneumob commented 8 years ago

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

axos88 commented 8 years ago

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

eheydrick commented 8 years ago

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

immusk commented 8 years ago

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?

agraziolo commented 8 years ago

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.

lcx commented 8 years ago

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
eheydrick commented 8 years ago

Is this still an issue?

fkwakkenbos commented 8 years ago

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.

valenbb commented 7 years ago

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.

majormoses commented 7 years ago

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.

tkaczerski commented 7 years ago

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:infs_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:inblock in '""]",1493906868,,standard,ACTIVE

majormoses commented 7 years ago

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

tkaczerski commented 7 years ago

/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 commented 7 years ago

All issues resolved after upgrading glibc.

majormoses commented 7 years ago

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