sensu-plugins / sensu-plugins-mongodb

This plugin provides native MongoDB instrumentation for monitoring and metrics collection, including: service health, database connectivity, replication lag/status, `oplog` monitoring, collection-specific metrics, and more.

Home Page:http://sensu-plugins.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't install on CentOS 7

soichih opened this issue · comments

I am trying to install this gem on my centos7 machine, but I can't

016-08-02 19:51:40 UTC [root@core-test1:/etc/sensu/conf.d]# /opt/sensu/embedded/bin/gem install sensu-plugins-mongodb
ERROR:  Error installing sensu-plugins-mongodb:
    sensu-plugins-mongodb requires Ruby version >= 2.1.

I am using sensu-client distributed via sensu.repo

baseurl=http://repos.sensuapp.org/yum/el/$basearch/

It currently distributes ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

Does this mean I can't install this gem unless I install yet another ruby binary on my machine? (I have one from the CentOS, and embedded ruby on /opt/sensu/embedded/bin/ruby..

Hi @soichih. The problem is the gem requires Ruby 2.1+ and you are trying to install it on Ruby 2.0. The best practice is to install plugin gems into the embedded ruby. Sensu currently ships with Ruby 2.3 so use that and you'll be able to install the mongo gem.

Sensu currently ships with Ruby 2.3

Maybe this is true on a different architecture, but not true on el7.x86_64.

$ sudo yum update sensu
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.tzulo.com
 * epel: mirror.steadfast.net
 * extras: ftpmirror.your.org
 * updates: cosmos.illinois.edu
No packages marked for update
 $ /opt/sensu/embedded/bin/ruby --version
ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-linux]

Which version of sensu do you have installed? With 0.25.6 on Centos 7 I get

$ /opt/sensu/embedded/bin/ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

Humm... that's odd.

$ rpm -qi sensu
Name        : sensu
Epoch       : 1
Version     : 0.20.3
Release     : 1
Architecture: x86_64
Install Date: Mon 12 Oct 2015 05:50:08 PM UTC
Group       : Monitoring
Size        : 63389004
License     : MIT License
Signature   : (none)
Source RPM  : sensu-0.20.3-1.src.rpm
Build Date  : Wed 12 Aug 2015 12:03:07 AM UTC
Build Host  : localhost.localdomain
Relocations : / 
Packager    : Sensu Helpdesk <helpdesk@sensuapp.com>
Vendor      : Heavy Water Operations, LLC.
URL         : http://sensuapp.org
Summary     : A monitoring framework that aims to be simple, malleable, and scalable.
Description :
A monitoring framework that aims to be simple, malleable, and scalable.
$ uname -a
Linux soichi7.ppa.iu.edu 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
$ cat /etc/yum.repos.d/sensu.repo 
[sensu]
name=sensu
baseurl=http://repos.sensuapp.org/yum/el/$basearch/
gpgcheck=0
enabled=1

Ah, you have the old repo. Update to http://repositories.sensuapp.org and you'll get new versions.

$ cat sensu.repo
[sensu]
name=sensu
baseurl=http://repositories.sensuapp.org/yum/$basearch/
gpgcheck=0
enabled=1

Success!

Thanks! I didn't know they updated the repo URL.. (why!?)

$ sudo /opt/sensu/embedded/bin/gem install sensu-plugins-mongodb
Fetching: bson-4.1.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed bson-4.1.1
Fetching: mongo-2.2.2.gem (100%)
Successfully installed mongo-2.2.2
Fetching: sensu-plugins-mongodb-1.0.0.gem (100%)
You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu
Successfully installed sensu-plugins-mongodb-1.0.0
Parsing documentation for bson-4.1.1
Installing ri documentation for bson-4.1.1
Parsing documentation for mongo-2.2.2
Installing ri documentation for mongo-2.2.2
Parsing documentation for sensu-plugins-mongodb-1.0.0
Installing ri documentation for sensu-plugins-mongodb-1.0.0
Done installing documentation for bson, mongo, sensu-plugins-mongodb after 17 seconds
3 gems installed