Page 1 of 1

MongoDB monitoring issue

Posted: Sat May 17, 2025 8:45 am
by lrnnetops
Hi Team,

Following the Nagios upgrade from 5.7.8 to the latest version on Ubuntu, all services and hosts are functioning as expected, except for the MongoDB monitoring script (/usr/local/nagios/libexec/check_mongodb.py). This is due to Python version incompatibility. The old Nagios server (CentOS 7) uses Python 2.17, while the new server uses Python 3.12.3. Please provide an updated script compatible with the latest Nagios version and Python 3.12.3 that will allow us to monitor all MongoDB statistics as before.
Refer the below screenshot
(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mongodb.py", line 57

Re: MongoDB monitoring issue

Posted: Sat May 17, 2025 8:14 pm
by kg2857
You might check if a python 2 is installed and if so edit the shebang line at the top of the script to use python2.

Re: MongoDB monitoring issue

Posted: Sun May 18, 2025 10:53 am
by lrnnetops
After installing Python 2.7.5 and updating the shebang, I'm getting a "No module named pymongo" error.

Re: MongoDB monitoring issue

Posted: Sun May 18, 2025 8:49 pm
by kg2857
You might want to install it.

Re: MongoDB monitoring issue

Posted: Mon May 19, 2025 11:44 am
by lrnnetops
do you have updated script that will support latest version of python.

Re: MongoDB monitoring issue

Posted: Mon May 19, 2025 8:20 pm
by kg2857
You may want to check the nagios exchange or the internet since this isn't likely to be a standard plugin.

Re: MongoDB monitoring issue

Posted: Thu May 22, 2025 7:21 am
by lrnnetops
CRITICAL - General MongoDB Error: command find requires authentication, full error: {'ok': 0.0, 'errmsg': 'command find requires authentication', 'code': 13, 'codeName': 'Unauthorized', '$clusterTime': {'clusterTime': Timestamp(1747916204, 2), 'signature': {'hash': b'\xf4=\x939\xe2\x97\xbc\xbc\xf7\xe3\xd5\x88\x91\x02\r\xc7\xdb\xd1\xc0\xe7', 'keyId': 7462416246990962689}}, 'operationTime': Timestamp(1747916204, 2)}

Nagios monitoring of MongoDB connections is reporting the above response.
I have configured using nagios configuration wizards