Link to home
Start Free TrialLog in
Avatar of blah30
blah30

asked on

nagios + check_mongodb.py

Hi
I have installed nagios 3.2.2 and the plug-ins check_mongo.py for some reason the plug-ins show some server in critical state with this message: CRITICAL - Connection to MongoDB failed!
its in a secure env so no authentication, I ran each check command that i have in my nrpe,cfg i.e:
command[check_mongo_connect]=/usr/local/nagios/libexec/check_mongodb.py -A connect -W 2 -C 4
command[check_mongo_free]=/usr/local/nagios/libexec/check_mongodb.py -A connections -W 70 -C 80
command[check_mongo_rep]=/usr/local/nagios/libexec/check_mongodb.py -A check_rep_lag -W 2 -C 80

on the client and the nagios host (with -H) it all returned connection ok but still nagios show them as critical, nrpe is running in xinetd.
Thanks
Avatar of stermeau
stermeau

Hi,

Sometime I ran into problems because the scripts are running using the user nagios and this can cause a problem if you use some temporary files etc.
You can try to redirect stout and stderr to a file to get more information by adding the following at the end of the command line
   >> /tmp/check_mongodb.log 2>&1
Avatar of blah30

ASKER

Thanks going to give a try and let you know the result
Avatar of blah30

ASKER

Nothing is being logged in if i run the command manually it just say connection ok for the first command, no error message but still show this command as critical on nagios GUI
If you ran the command by hand, remove the file otherwise nagios would not be able to write to it.
Your commands looks lime this?
command[check_mongo_connect]=/usr/local/nagios/libexec/check_mongodb.py -A connect -W 2 -C 4 >> /tmp/check_mongodb.log 2>&1
command[check_mongo_free]=/usr/local/nagios/libexec/check_mongodb.py -A connections -W 70 -C 80 >> /tmp/check_mongodb.log 2>&1
command[check_mongo_rep]=/usr/local/nagios/libexec/check_mongodb.py -A check_rep_lag -W 2 -C 80 >> /tmp/check_mongodb.log 2>&1

But there is nothing in this file /tmp/check_mongodb.log ?
Avatar of blah30

ASKER

yep that's it for the command and their is no file created so far
Avatar of blah30

ASKER

Also I did /usr/local/nagios/libexec/check_nrpe -H xx.xx.xx.xx and the socket is timing out after 10 secondes, I have checked the linux iptables no rules here and checked the firewall the port 5666 is open as well as others that might be needed by it. Not sure where to look as I cannot find any infos on this issue.
I think you need to add -H x.x.x.x to each of your NRPE commands, even if it's just localhost, otherwise the check_mongo.py plugin won't know which server to contact.

The fact that you're getting "CRITICAL - Connection to MongoDB failed!" with a critical severity indicates that NRPE is running the command properly, as that's the what happens when pymongo.errors.ConnectionFailure is thrown inside the script.
Avatar of blah30

ASKER

HI group0 thanks for the answer,
I tried with the -H but to no avail i tried both public and private ip public will not work and the private does look like it work, now if i do from the nagios server  /usr/local/nagios/libexec/check_nrpe -H xx.xx.xx.xx then i get a CHECK_NRPE: Socket timeout after 10 seconds.
Avatar of blah30

ASKER

Strange thing is if i do the -H <10.xx.xx.xx>manually from the nagios server i will get the result expected
but so far i made the changes on the client and still no go.
Thanks.

nrpe command
command[check_mongo_connect]=/usr/local/nagios/libexec/check_mongodb.py -H localhost -A connect -W 2 -C 4                                                  
command[check_mongo_free]=/usr/local/nagios/libexec/check_mongodb.py -H localhost -A connections -W 70 -C 80                                                
command[check_mongo_rep]=/usr/local/nagios/libexec/check_mongodb.py -H localhost -A check_rep_lag -W 2 -C 80

like i said tried with the private ip as well to no avail
Avatar of blah30

ASKER

found the reason, someone took off the active check on nagios this does resolve this issue, thanks to everyone that helped i will distribute the point soon
ASKER CERTIFIED SOLUTION
Avatar of group0
group0

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, disregard my last comment, I see our updates crossed in the night :)