MongoDB monitoring issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
lrnnetops
Posts: 102
Joined: Thu May 18, 2017 5:31 am

MongoDB monitoring issue

Post 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
kg2857
Posts: 490
Joined: Wed Apr 12, 2023 5:48 pm

Re: MongoDB monitoring issue

Post 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.
lrnnetops
Posts: 102
Joined: Thu May 18, 2017 5:31 am

Re: MongoDB monitoring issue

Post by lrnnetops »

After installing Python 2.7.5 and updating the shebang, I'm getting a "No module named pymongo" error.
kg2857
Posts: 490
Joined: Wed Apr 12, 2023 5:48 pm

Re: MongoDB monitoring issue

Post by kg2857 »

You might want to install it.
lrnnetops
Posts: 102
Joined: Thu May 18, 2017 5:31 am

Re: MongoDB monitoring issue

Post by lrnnetops »

do you have updated script that will support latest version of python.
kg2857
Posts: 490
Joined: Wed Apr 12, 2023 5:48 pm

Re: MongoDB monitoring issue

Post by kg2857 »

You may want to check the nagios exchange or the internet since this isn't likely to be a standard plugin.
lrnnetops
Posts: 102
Joined: Thu May 18, 2017 5:31 am

Re: MongoDB monitoring issue

Post 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
Post Reply