Issue while monitoring MONGODB - After update
Posted: Tue Dec 23, 2025 11:06 am
Hi Everyone,
Could anyone please help me out with MongoDB monitoring as I am currently facing the issue after the update, previously it used to be working fine.
current Nagios xi version : 2026R1.0.1
Below are the service checks that i'm trying to do:
$USER1$/check_mongodb.py -H $HOSTADDRESS$ -A connect -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -d $ARG7$ -D
$USER1$/check_mongodb.py -H $HOSTADDRESS$ -A database_size -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -d $ARG7$ -D
Below is the error that I'm getting
(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mongodb.py", line 57
while using the latest plugin check_mongodb_3.py
CRITICAL - General MongoDB Error: Command dbStats requires authentication, full error: {'ok': 0.0, 'errmsg': 'Command dbStats requires authentication', 'code': 13, 'codeName': 'Unauthorized', '$clusterTime': {'clusterTime': Timestamp(1766505564, 4), 'signature': {'hash': b'\xf1mX6\xd8\xf2\xeaI\x06vl\xe1\x81\xf4]\x1b\x98\xcb\x87\x15', 'keyId': 7551555020454363137}}, 'operationTime': Timestamp(1766505564, 4)}
Any suggestions.
I can confirm that I am able to connect to DB as below
python3 testmongonagios.py
Connected successfully
Databases: ['admin', 'config', 'local', 'sync-qa', 'sync-us1']
from pymongo import MongoClient
from pymongo.errors import OperationFailure
try:
client = MongoClient("mongodb://user:password@IP:port/?authSource=admin")
print("
Connected successfully")
print("Databases:", client.list_database_names())
except OperationFailure as e:
print("
Operation failed:", e)
except Exception as e:
print("
Connection error:", e)
Please help on this
Could anyone please help me out with MongoDB monitoring as I am currently facing the issue after the update, previously it used to be working fine.
current Nagios xi version : 2026R1.0.1
Below are the service checks that i'm trying to do:
$USER1$/check_mongodb.py -H $HOSTADDRESS$ -A connect -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -d $ARG7$ -D
$USER1$/check_mongodb.py -H $HOSTADDRESS$ -A database_size -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -d $ARG7$ -D
Below is the error that I'm getting
(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mongodb.py", line 57
while using the latest plugin check_mongodb_3.py
CRITICAL - General MongoDB Error: Command dbStats requires authentication, full error: {'ok': 0.0, 'errmsg': 'Command dbStats requires authentication', 'code': 13, 'codeName': 'Unauthorized', '$clusterTime': {'clusterTime': Timestamp(1766505564, 4), 'signature': {'hash': b'\xf1mX6\xd8\xf2\xeaI\x06vl\xe1\x81\xf4]\x1b\x98\xcb\x87\x15', 'keyId': 7551555020454363137}}, 'operationTime': Timestamp(1766505564, 4)}
Any suggestions.
I can confirm that I am able to connect to DB as below
python3 testmongonagios.py
Databases: ['admin', 'config', 'local', 'sync-qa', 'sync-us1']
from pymongo import MongoClient
from pymongo.errors import OperationFailure
try:
client = MongoClient("mongodb://user:password@IP:port/?authSource=admin")
print("
print("Databases:", client.list_database_names())
except OperationFailure as e:
print("
except Exception as e:
print("
Please help on this