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.rb fails on a Centos6 machine while metrics-disk.rb is fine #129

Closed zenmetsu closed 4 years ago

zenmetsu commented 5 years ago

Using plugin with Sensu Go, and using the Centos6 ruby runtime asset, I get the following with check-disk-usage.rb

/var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require': libffi.so.6: cannot open shared object file: No such file or directory - /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/ffi-1.10.0/lib/ffi_c.so (LoadError) from /var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/ffi-1.10.0/lib/ffi.rb:6:in 'rescue in <top (required)>' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/ffi-1.10.0/lib/ffi.rb:3:in '<top (required)>' from /var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem/structs.rb:1:in '<top (required)>' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem.rb:2:in 'require_relative' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/unix/sys/filesystem.rb:2:in '<top (required)>' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/filesystem.rb:11:in 'require_relative' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/gems/sys-filesystem-1.1.7/lib/sys/filesystem.rb:11:in '<top (required)>' from /var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/cache/sensu/sensu-agent/353906de7f7cbb91e9d6f4706a6cae72a2646926e2c34753f8957f57428ef4c381c93b98224632dedd92a44199c325cc06a5f21824da1087d6463ce594985038/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/lib/ruby/2.4.0/bundler/gems/sensu-plugins-disk-checks-73a6f8b6f566/bin/check-disk-usage.rb:29:in '<top (required)>' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/bin/check-disk-usage.rb:14:in 'load' from /var/cache/sensu/sensu-agent/0ce9d52b270b77f4cab754e55732ae002228201d0bd01a89b954a0655b88c1ee6546e2f82cfd1eec04689af90ad940cde128e8867912d9e415f4a58d7fdcdadf/bin/check-disk-usage.rb:14:in '<main>'

The metrics-disk.rb check works fine, however. It appears that the ruby-runtime is including libffi.so.5 instead of libffi.so.6.

jspaleta commented 5 years ago

yeah we need to respin this and include a matching centos6 build

zenmetsu commented 5 years ago

it looks like the problem might actually be with the ruby runtime centos6 package. I'll close this one if so.

jspaleta commented 5 years ago

no its definitely this one. We are still working out how we need to deal with supporting different "platforms" and correctly handle where libraries are installed.

The problem here is.. this was built only against the centos7 runtime (the centos6 runtime is a new image) The centos7 runtime has a different release of the library than the centos6 runtime and this asset is depending on the library installed as part of the runtime.

Shared libraries complicate things and produce a ton of little corners.
Ideally we want assets to provide all the shared libraries they need as part of themselves.. but we decided we wanted to take the burden of having to package ruby in every plugin and construct a reusable runtime,.

The interaction with the ruby runtime asset complicates things further.

So what needs to happen for any plugin that uses native extensions the asset building needs to vaccuum up any libraries on the system (except the glibc libraries like pthread which MUST be provided by the OS) and package them as part of the asset payload.

zenmetsu commented 5 years ago

OK.

For what it worth, I used the Centos7 ruby runtime instead by changing the filter, and then it complained about glibc-2.15 being missing. I installed glibc-2.15 into /tmp, bundled that up into an asset and included that, and the check works fine. It is a workaround until the centos6 runtime is added here.

seifer44 commented 4 years ago

Turns out that this is no longer an issue with the 5.0.1 assets. Can we close this issue? I just went down an unnecessary rabbit hole yesterday, thinking this was still a problem, and would like to spare others my pain.

jspaleta commented 4 years ago

Yeah closing. I think we sorted the glibc issues out with the ruby-runtime asset. now

deurk commented 4 years ago

Hi, running in this trouble with 5.1.1:

  sensu-plugins/sensu-plugins-disk-checks   //assets.bonsai.sensu.io/.../sensu-plugins-disk-checks_5.1.1_centos6_linux_amd64.tar.gz        a0c2cdc

Any pointer to circumvent the issue?