mongoDB Nagios Monitoring

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
rmuhammadali
Posts: 27
Joined: Sat Dec 13, 2014 4:02 am

mongoDB Nagios Monitoring

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: mongoDB Nagios Monitoring

Post by slansing »

Can you please share what value $USER1$ holds in:

Code: Select all

~nagios/etc/resource.cfg
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
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: mongoDB Nagios Monitoring

Post 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
rmuhammadali
Posts: 27
Joined: Sat Dec 13, 2014 4:02 am

Re: mongoDB Nagios Monitoring

Post 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
rmuhammadali
Posts: 27
Joined: Sat Dec 13, 2014 4:02 am

Re: mongoDB Nagios Monitoring

Post by rmuhammadali »

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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: mongoDB Nagios Monitoring

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
emislivec
Posts: 52
Joined: Tue Feb 25, 2014 10:06 am

Re: mongoDB Nagios Monitoring

Post 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 root@192.168.1.10
/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.
rmuhammadali
Posts: 27
Joined: Sat Dec 13, 2014 4:02 am

Re: mongoDB Nagios Monitoring

Post 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
NRPE Unable to read output.jpg
NRPE Unable to read output 1.jpg
Now suggest what to do.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: mongoDB Nagios Monitoring

Post 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:

Code: Select all

/etc/xinetd.d/nrpe
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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
rmuhammadali
Posts: 27
Joined: Sat Dec 13, 2014 4:02 am

Re: mongoDB Nagios Monitoring

Post by rmuhammadali »

no dear, its not running under xinetd.
Locked