Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-disk-usage plugin failing #31

Open
sputturao opened this issue Jan 21, 2016 · 20 comments
Open

check-disk-usage plugin failing #31

sputturao opened this issue Jan 21, 2016 · 20 comments

Comments

@sputturao
Copy link

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
Copy link
Author

OS is Oracle Linux

@sputturao
Copy link
Author

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
Copy link

axos88 commented Feb 1, 2016

+1

1 similar comment
@willneumob
Copy link

+1

@eheydrick
Copy link
Contributor

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

@willneumob
Copy link

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

@axos88
Copy link

axos88 commented Apr 22, 2016

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

@eheydrick
Copy link
Contributor

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

@immusk
Copy link

immusk commented May 2, 2016

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
Copy link

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
Copy link

lcx commented Jul 26, 2016

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
Copy link
Contributor

Is this still an issue?

@fkwakkenbos
Copy link

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
Copy link

valenbb commented Mar 30, 2017

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
Copy link
Member

majormoses commented May 4, 2017

I just did a release: #70 can someone try it and see if the issue is resolved, if not I will start taking a look at this issue.

@tkaczerski
Copy link

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

@majormoses
Copy link
Member

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

@tkaczerski
Copy link

/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
Copy link

All issues resolved after upgrading glibc.

@majormoses
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests