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.rb fails due to incompatible library version #75

Open
talonx opened this issue Jul 19, 2017 · 2 comments
Open

check-disk-usage.rb fails due to incompatible library version #75

talonx opened this issue Jul 19, 2017 · 2 comments

Comments

@talonx
Copy link

talonx commented Jul 19, 2017

OS: Ubuntu 16.04.2 LTS

Ruby : ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] - installed via apt-get, so this is the default for this Ubuntu version

Sensu : Installed via sensu_1.0.0-1_amd64.deb

check-disk plugin installed using "sudo gem install sensu-plugins-disk-checks"

When this plugin is invoked by Sensu, the following error comes in the output

Ignoring ffi-1.9.18 because its extensions are not built.  Try: gem pristine ffi --version 1.9.18
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring eventmachine-1.2.2 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.2
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring oj-2.18.1 because its extensions are not built.  Try: gem pristine oj --version 2.18.1
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': incompatible library version - /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ffi-1.9.18/lib/ffi_c.so (LoadError)
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
	from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ffi-1.9.18/lib/ffi.rb:6:in `rescue in <top (required)>'
	from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/ffi-1.9.18/lib/ffi.rb:3:in `<top (required)>'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
	from /var/lib/gems/2.3.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem/structs.rb:1:in `<top (required)>'
	from /var/lib/gems/2.3.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem.rb:2:in `require_relative'
	from /var/lib/gems/2.3.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem.rb:2:in `<top (required)>'
	from /var/lib/gems/2.3.0/gems/sys-filesystem-1.1.7/lib/sys/filesystem.rb:11:in `require_relative'
	from /var/lib/gems/2.3.0/gems/sys-filesystem-1.1.7/lib/sys/filesystem.rb:11:in `<top (required)>'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
	from /var/lib/gems/2.3.0/gems/sensu-plugins-disk-checks-2.3.0/bin/check-disk-usage.rb:29:in `<top (required)>'
	from /usr/local/bin/check-disk-usage.rb:23:in `load'
	from /usr/local/bin/check-disk-usage.rb:23:in `<main>'
@majormoses
Copy link
Member

Sensu > 0.29 is not yet officially supported by the plugins yet due to incompatibilities, if you are looking for something safe and stable I would go 0.28 until we have have completed all the work to get all of these working with ruby 2.4. You can read more about this here: https://blog.sensuapp.org/community-maintenance-mode-d109e75bcbc4

Did you try executing the commands it gave you?

Ignoring ffi-1.9.18 because its extensions are not built.  Try: gem pristine ffi --version 1.9.18
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6
Ignoring json-1.8.6 because its extensions are not built.  Try: gem pristine json --version 1.8.6

If I had to guess I would say that is it due to conflicting gem requirements on sensu-plugins 2.x which is included with sensu 1.x while this plugin still requires https://github.com/sensu-plugins/sensu-plugins-disk-checks/blob/2.3.0/sensu-plugins-disk-checks.gemspec#L34 leading to this situation. Almost all the of gems have at this point gone through install time testing (a few that unfortunately we don't have a viable upgrade path for yet). We will be starting with runtime testing shortly and will be making 2.x a requirement.

@majormoses
Copy link
Member

@talonx sorry getting back around to look at some of these issues.

check-disk plugin installed using "sudo gem install sensu-plugins-disk-checks"

If you are not giving the path to the embedded ruby gem such as sudo /opt/sensu/embedded/bin/gem install sensu-plugins-disk-checks it will install it in the system wide ruby you installed which is 2.3.1.

Can you please confirm whether sensu is intending to use it's embedded gems by running this? grep EMBEDDED_RUBY /etc/default/sensu and pasting the output.

Assuming that you are intending to use embedded gems and install it into the same embedded ruby I think you will likely run into the same issue and what we need to do is to bump the dependency on json and sensu-plugin gems most likely. Let me know as I was unable to quickly replicate here.

Testing with ruby 2.2.5:

$ ruby --version
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
$ bundle exec ./bin/check-disk-usage.rb
CheckDisk OK: All disk usage under 85% and inode usage under 85%

Testing with ruby 2.4.1:

$ rbenv local 2.4.1
$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ bundle
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Using rake 10.5.0
Using json 1.8.6
Using mixlib-cli 1.7.0
Using ffi 1.9.18
Using docile 1.1.5
Fetching simplecov-html 0.10.2
Installing simplecov-html 0.10.2
Using github-markup 1.6.1
Using coderay 1.1.1
Using method_source 0.8.2
Using slop 3.6.0
Using redcarpet 3.4.0
Using rspec-support 3.6.0
Using diff-lcs 1.3
Using ast 2.3.0
Using powerpack 0.1.1
Using ruby-progressbar 1.8.1
Using unicode-display_width 1.3.0
Using yard 0.9.9
Using bundler 1.15.1
Using rainbow 2.2.2
Using sensu-plugin 1.4.5
Using sys-filesystem 1.1.7
Fetching simplecov 0.15.0
Installing simplecov 0.15.0
Using pry 0.10.4
Using rspec-core 3.6.0
Using rspec-expectations 3.6.0
Using rspec-mocks 3.6.0
Using parser 2.4.0.0
Using sensu-plugins-disk-checks 2.5.0 from source at `.`
Using codeclimate-test-reporter 0.6.0
Using rspec 3.6.0
Using rubocop 0.40.0
Bundle complete! 10 Gemfile dependencies, 32 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
The latest bundler is 1.15.4, but you are currently running 1.15.1.
To update, run `gem install bundler`
$ bundle exec ./bin/check-disk-usage.rb
CheckDisk OK: All disk usage under 85% and inode usage under 85%

I can put together a PR and have you test bumping the version of sensu-plugins and see if that solves your issue.

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

2 participants