Page 1 of 2
mongoDB Nagios Monitoring
Posted: Sat Dec 13, 2014 4:19 am
by rmuhammadali
Dear All,
I am unable to monitor the mongoDB and stuck in an error: (Return code of 126 is out of bounds - plugin may not be executable).
1) When i execute directly
# /usr/lib64/nagios/plugins/check_mongodb -H 192.168.2.8 -A connections -W 10 -C 20
OK - 0 percent (1 of 51200 connections used)
it gives acurate output.
2) But when i execute it through service/command it gives the mentioned error.
define service {
use generic-service
host_name mongoDB
service_description MongoDB
check_command check_mongodb!connections!27017!10!20
}
defince command {
command_name check_mongodb
command_line $USER1$/check_mongodb -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
}
3) service nagios restart executied but on updating nagios console found "Return code of 126 is out of bounds - plugin may not be executable" with Status-Critical.
Please help out to manage this issue.
Regards
RMA
Re: mongoDB Nagios Monitoring
Posted: Mon Dec 15, 2014 10:52 am
by slansing
Can you please share what value $USER1$ holds in:
It's possible that that value is pointing to the wrong directory, or do all of your other checks with $USER1$ work fine? Also, what is the output of:
Code: Select all
ls -la /usr/lib64/nagios/plugins/check_mongodb
Re: mongoDB Nagios Monitoring
Posted: Mon Dec 15, 2014 10:56 am
by emislivec
Also, is the plugin executable by the nagios user?
Code: Select all
sudo -u nagios /usr/lib64/nagios/plugins/check_mongodb -H 192.168.2.8 -A connections -W 10 -C 20
The permissions on the plugin should look like this (check_ping as an example):
Code: Select all
-rwxr-xr-x. 1 nagios nagios 176433 May 19 2014 /usr/local/nagios/libexec/check_ping
Re: mongoDB Nagios Monitoring
Posted: Mon Dec 15, 2014 11:44 pm
by rmuhammadali
PS: slansing
Nagios Resource file contains the $USER1$ value "/usr/lib64/nagios/plugins" & Output of
Code: Select all
/usr/lib64/nagios/plugins/check_mongodb
OK - Connection took 0 seconds
PS: emislivec
Write permissions for check_mongody.py is as
Code: Select all
-rwxr-xr-x. 1 root root 59053 Nov 25 20:24 /usr/lib64/nagios/plugins/check_mongodb.py
Re: mongoDB Nagios Monitoring
Posted: Tue Dec 16, 2014 1:56 am
by rmuhammadali
Dear All,
Cannot understand this execution, according to me every this fine but unable to get manage, please help me out.
Re: mongoDB Nagios Monitoring
Posted: Tue Dec 16, 2014 5:16 pm
by abrist
Can you run the check through nrpe on the remote box?
Code: Select all
./check_nrpe -H localhost -p 5666 -c check_mongo_free
Re: mongoDB Nagios Monitoring
Posted: Tue Dec 16, 2014 5:34 pm
by emislivec
rmuhammadali wrote:Dear All,
Cannot understand this execution, according to me every this fine but unable to get manage, please help me out.
mongoDB NRPE Error - Nagios Support.jpg
Did you get your original problem fixed? It's easier for us to help you if we keep threads to one topic.
Does your plugin live at "/usr/lib64/nagios/plugins/check_mongodb"? Where did "/usr/lib64/nagios/plugins/check_mongodb.py" come from?
Are you trying to run
Code: Select all
/usr/lib64/nagios/plugins/check_mongodb -H 192.168.2.8 -A connections -W 10 -C 20
or
Code: Select all
/usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
?
What happens when you run your command on the NRPE box (run these exact commands):
Code: Select all
ssh [email protected]
/usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
sudo -u nagios /usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
Take a look at
http://assets.nagios.com/downloads/nagi ... utions.pdf. It says XI, but it applies to NRPE in general.
You may need to add "sudo " to the start of your command definition in nrpe.cfg, and add a sudoers rule for the nagios user. The doc I linked shows an example of this.
Re: mongoDB Nagios Monitoring
Posted: Wed Dec 17, 2014 1:00 am
by rmuhammadali
Dear,
let me define myself again.
1) plugin is placed @ /usr/lib64/nagios/plugins directory
Code: Select all
[root@cent plugins]# ls -al check_mongodb*
lrwxrwxrwx. 1 root root 42 Dec 15 15:47 check_mongodb -> /usr/lib64/nagios/plugins/check_mongodb.py
-rwxr-xr-x. 1 root root 59053 Nov 25 20:24 check_mongodb.py
2) command @ my client /etc/nagios/nrpe.cfg
Code: Select all
command[check_mongo_free]=/usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
& allowed hosts @ my client /etc/nagios/nrpe.cfg
Code: Select all
allowed_hosts=127.0.0.1,192.168.2.10
3) as i write befone about error "Return code of 126 is out of bounds - plugin may not be executable", its already resolved, as i change file permoissions.
4) both commands show same results on nagios server
Code: Select all
/usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
OK - 0 percent (1 of 51200 connections) used
sudo -u nagios /usr/lib64/nagios/plugins/check_mongodb -A connections -P 27017 -W 80 -C 90
OK - 0 percent (1 of 51200 connections) used
commands running good but when i tried to fetch through service it gives below error.
5) my configurations @ nagios server /etc/nagios/myconf
Code: Select all
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 160
}
Code: Select all
define command {
command_name check_mongodb
command_line $USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
}
Code: Select all
define service{
use generic-service
host_name CENT
service_description Mongo Free Connections
check_command check_nrpe!check_mongo_free!connections!27017!70!80
}
6) nagios core result
Now suggest what to do.
Re: mongoDB Nagios Monitoring
Posted: Wed Dec 17, 2014 1:41 am
by Box293
rmuhammadali wrote:& allowed hosts @ my client /etc/nagios/nrpe.cfg
Code: Select all
allowed_hosts=127.0.0.1,192.168.2.10
If nrpe on the remote host is being started under xinetd then please check:
Update the only_from directive, for example:
Code: Select all
only_from = 127.0.0.1 192.168.2.10
only_from uses a single space between IP Addresses.
Then restart the xinetd service.
Re: mongoDB Nagios Monitoring
Posted: Wed Dec 17, 2014 11:24 pm
by rmuhammadali
no dear, its not running under xinetd.