check_mongodb.py

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

check_mongodb.py

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_mongodb.py

Post 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.
Former Nagios Employee
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: check_mongodb.py

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_mongodb.py

Post by rkennedy »

What is the exact syntax you are attempting to use with it?
Former Nagios Employee
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: check_mongodb.py

Post 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.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_mongodb.py

Post 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.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: check_mongodb.py

Post 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?
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: check_mongodb.py

Post by encee »

To add to this ive tried using the FQDN as well as the IP address

I
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_mongodb.py

Post 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?
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
encee
Posts: 13
Joined: Thu Dec 03, 2015 12:29 pm

Re: check_mongodb.py

Post by encee »

I tried specifying a database still no luck same error.

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