Page 1 of 1

Issue while monitoring MONGODB - After update

Posted: Tue Dec 23, 2025 11:06 am
by DileepKumar
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

Re: Issue while monitoring MONGODB - After update

Posted: Mon Dec 29, 2025 12:52 pm
by DileepKumar
Hi @SallyKirkland,

Thank you very much for the info.

But, as i mentioned, previously it was working fine until I upgraded the Nagios to the latest version and no changes have been made from DB end w.r.to the user rights.

I have been using right command arguments and user with correct access rights, However, the checks are failing.


Thank you

Re: Issue while monitoring MONGODB - After update

Posted: Mon Jan 05, 2026 9:56 am
by cdepaulis
Hello,

Could you provide which version you upgraded from as I am not seeing any changes as of recently to the plugin. Along with that I am curious what OS you are on. I am assuming OS shouldn't be an issue, but it would be helpful for testing. Lastly, have you tried running this in the CLI itself? If so is the output similar?

- Caleb

Re: Issue while monitoring MONGODB - After update

Posted: Mon Jan 05, 2026 12:42 pm
by DileepKumar
Hi,

Below are my OS details

NAME="Oracle Linux Server"
VERSION="9.6"


Issue occurred when updated Nagios XI from rom version 2026R1 to 2026R1.0.1 and currently I am on 2026R1.1 and still facing the issue.

also, is it possible to find the changes after 2024R2 version

and Yes, below is the error that I am getting while running the command using CLI

./check_mongodb_3.py -H IPP -A database_size -P PORT -W 85 -C 90 -u USER -p PASSWORD -d DBNAME -D

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(1767631747, 1), 'signature': {'hash': b'S\xf8P\xed\xba\xc1\xdb\xae\xfa\x10\xf6\x0ch\xa7\xb3\x80 \xa8R\x91', 'keyId': 7551555020454363137}}, 'operationTime': Timestamp(1767631747, 1)}



Below are the access rights that I have for that DB
{
_id: 'admin.nagiosmon',
userId: UUID('a94363ee-57c4-4ba3-aa3b-e7835e6cf1d2'),
user: 'nagiosmon',
db: 'admin',
roles: [
{ role: 'readWrite', db: 'admin' },
{ role: 'clusterMonitor', db: 'admin' },
{ role: 'readAnyDatabase', db: 'admin' },
{ role: 'dbAdminAnyDatabase', db: 'admin' }
],
mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
}

Re: Issue while monitoring MONGODB - After update

Posted: Tue Jan 13, 2026 10:30 am
by cdepaulis
Hello,

Thank you for the information. I have tried the plugin on our mongoDB database and everything appears to be working normally. The file itself hasn't been touched since the release of 2024R1.4.2, so nothing should have changed. My only thought is its something with your mongoDB has changed or could be wrong, but I am not 100% sure. This would probably be easier for support to diagnose, so I would recommend going to them if you are unable to figure it out.

- Caleb

Re: Issue while monitoring MONGODB - After update

Posted: Mon Feb 02, 2026 2:05 am
by DileepKumar
My DB team confirmed that there has been no changes made after it is build but still same issue while trying to monitor even using default methods like given plugins from core configuration wizards