Hi Team,
We are trying to monitor our Mongo DB servers which are in cluster.
Nagios XI = 5.5.7
Python version on Nagios Xi server = 2.6.6
Mongo DB server Version = v3.6.5
Tested connectivity from Nagios Xi server to Mongo DB server using telnet & its working.
We created user with "clusterAdmin" role. tested login from Nagios XI server using mongo shell & able to successfully login on mongo DB server.
However when we trying to monitor mongo DB server using below command we are getting below error.
================
/usr/local/nagios/libexec/check_mongodb.py -H xxx.xxx.xxx.xxx -A connect -P xxxxx -W 2 -C 4 -u xxxxxxxx -p xxxxxxxx -D --all-databases
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'
================
Note = we are using backdated version of "check_mongodb.py" as we are not planning to upgrade python version & upgraded "check_mongodb.py" i guess required python 2.7.x. so we using backdated version of "check_mongodb.py" from which we are able to successfully monitor other mongo servers which are not in cluster.
when we tried with upgraded "check_mongodb.py" we got below error.
=============
/usr/local/nagios/libexec/check_mongodb_upgrade.py -H xxx.xxx.xxx.xxx -A connect -P xxxxx -W 2 -C 4 -u xxxxxxxx -p xxxxxxxx -D --all-databases
Username/Password incorrect
=============
Attached () for the error we are getting on XI.
Please suggest the fix for the same.
Mongo DB monitoring Error
Mongo DB monitoring Error
You do not have the required permissions to view the files attached to this post.
Re: Mongo DB monitoring Error
It's likely failing for both versions for the same reasons but the newer one handles it a bit better. Are there any special characters in the username or password? Can you try simple credentials as a test? The message indicates a failure to login - are there any logs on the mongo db side regarding this failure?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Mongo DB monitoring Error
Hi cdienger,
No Special characters in username as well as password.
We tested login to Mongo DB server by installing mongo client on Nagios server (Output as below).
Using same credentials we tried old version check_mongodb.py plugin but got below error.
We also tested with updated check_mongodb_upgrade.py plugin & got below error.
Please check & let us know the fix on it.
No Special characters in username as well as password.
We tested login to Mongo DB server by installing mongo client on Nagios server (Output as below).
Using same credentials we tried old version check_mongodb.py plugin but got below error.
We also tested with updated check_mongodb_upgrade.py plugin & got below error.
Please check & let us know the fix on it.
You do not have the required permissions to view the files attached to this post.
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Mongo DB monitoring Error
@ lrnnetops, Can you check and let us know which version of pymongo you have installed on the Nagios server?
What version of MongoDB and what kind of authentication schema is being used? MONGODB-CR, SCRAM-SHA-1 or another one?[root@centos7x64 libexec]# pip list installed | grep pymongo
pymongo (3.7.2)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Mongo DB monitoring Error
Hi npolovenko,
Pymongo version is = pymongo (2.5.2)
Mongo server version as below =
================
db version v3.6.5
allocator: tcmalloc
modules: enterprise
build environment:
distmod: amzn64
distarch: x86_64
target_arch: x86_64
================
We are not sure about authentication schema. if possible can you share the db query which can fetch this data. We are sharing our mongo config as below.
================
# network interfaces
net:
port: <PORT>
bindIp: <PRIVATE IP>,127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
#security:
security:
authorization: enabled
keyFile: /etc/mongod/<KEYFILENAME>
enableEncryption: true
encryptionCipherMode: AESXXX-XXX
encryptionKeyFile: /etc/mongod/<ENCRYPTION KEY FILE>
#operationProfiling:
replication:
replSetName: "<REPL NAME>"
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
================
Let me know if you require any details.
Pymongo version is = pymongo (2.5.2)
Mongo server version as below =
================
db version v3.6.5
allocator: tcmalloc
modules: enterprise
build environment:
distmod: amzn64
distarch: x86_64
target_arch: x86_64
================
We are not sure about authentication schema. if possible can you share the db query which can fetch this data. We are sharing our mongo config as below.
================
# network interfaces
net:
port: <PORT>
bindIp: <PRIVATE IP>,127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
#security:
security:
authorization: enabled
keyFile: /etc/mongod/<KEYFILENAME>
enableEncryption: true
encryptionCipherMode: AESXXX-XXX
encryptionKeyFile: /etc/mongod/<ENCRYPTION KEY FILE>
#operationProfiling:
replication:
replSetName: "<REPL NAME>"
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
================
Let me know if you require any details.
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Mongo DB monitoring Error
@lrnnetops, Can you update pymongo to the version 3.7.2 and let me know if it fixes the issue?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Mongo DB monitoring Error
Hi npolovenko,
We are using old version of plugin "check_mongodb.py" for mongo DB monitoring as newer version of plugin requires python 2.7.
Our server currently running with python 2.6.6.
Please confirm upgrading pymongo to the version 3.7.2 wont affect our current mongo DB monitoring.
We are using old version of plugin "check_mongodb.py" for mongo DB monitoring as newer version of plugin requires python 2.7.
Our server currently running with python 2.6.6.
Please confirm upgrading pymongo to the version 3.7.2 wont affect our current mongo DB monitoring.
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Mongo DB monitoring Error
@lrnnetops, Do you happen to have a linux box or a VM with a newer python version? That way you could upload the new plugin there, upgrade pymongo and test it out with your MongoDB database. That way we'll know for sure if python version is the issue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.