Page 1 of 2

check_mongodb.py

Posted: Thu Dec 03, 2015 12:34 pm
by encee
Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_mongodb.py", line 1372, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/local/nagios/libexec/check_mongodb.py", line 196, in main
err, con = mongo_connect(host, port, ssl, user, passwd, replicaset)
File "/usr/local/nagios/libexec/check_mongodb.py", line 294, in mongo_connect
return exit_with_general_critical(e), None
File "/usr/local/nagios/libexec/check_mongodb.py", line 310, in exit_with_general_critical
if e.strip() == "not master":
AttributeError: 'OperationFailure' object has no attribute 'strip'


Trying to monitor a mongo replica set, 2 data nodes 1 arb.

Mongo is running on the server and working fine for our applications, access between them is open. ClusterAdmin is set on the user.

Connection strings that pass -

check_mondb.py -h
check_mongodb.py -H IP -u "" -p ""

I am not sure why these are all failing. Any ideas?

Re: check_mongodb.py

Posted: Thu Dec 03, 2015 4:37 pm
by rkennedy
I read through an old post here @ https://support.nagios.com/forum/viewto ... =6&t=32945

Does the Nagios user have access to the Mongo DB? By default, it will only allow localhost.

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 11:17 am
by encee
My apologies I never recieved an email notification!

Yes the server/user does have access to mongo. Do we know if this supports mongo 3.0+ ? We aren't using SSL on these machines either that I am aware of just keyFiles, I noticed in the error its trying to put it into the connection string.

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 2:39 pm
by rkennedy
What is the exact syntax you are attempting to use with it?

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 2:47 pm
by encee
I am using the mongo server wizard in XI but here is the result of one of the failed services. All of them are failing with the same error.

check_mongodb_server!collections!27017!300!500!USER!PASS

I attempted to debug some on the command line but never got passed the same error while specifying any information.

check_mongodb.py -H IP -u "" -p "" This command was intentionally sent with an empty user and password. IP is of course removed.

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 2:56 pm
by jolson
When it comes to that mongodb plugin, it has a tendency to stack trace instead of producing valuable error output. Please verify that you can see the open ports appropriate from your nagios server:

Code: Select all

yum install nmap
nmap mongo.db.server.ip -pX
Where mongo.db.server.ip is the IP address of your mongodb server and X is the port number you use to auth against.

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 3:04 pm
by encee
Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-18 13:01 MST
Nmap scan report for mongodbIP
Host is up (0.00040s latency).
PORT STATE SERVICE
27017/tcp open unknown

Port is open, are there any additional packages that are required with this plugin?

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 3:13 pm
by encee
To add to this ive tried using the FQDN as well as the IP address

I

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 3:36 pm
by jolson
check_mongodb.py -H IP -u "" -p "" This command was intentionally sent with an empty user and password. IP is of course removed.
I noticed that you didn't specify a database. Try the following:
./check_mongodb.py -H IP -u "" -p "" -d <database>

Are you targeting the master node or the replica sets?

Re: check_mongodb.py

Posted: Fri Dec 18, 2015 4:40 pm
by encee
I tried specifying a database still no luck same error.

I am wanting to monitor the replica set in its entirety.