mzupan / nagios-plugin-mongodb

A Nagios plugin to check the status of MongoDB
BSD 2-Clause "Simplified" License
346 stars 274 forks source link

Incompatible with MongoDB 5.0.X? #257

Open MoBlockbuster opened 2 years ago

MoBlockbuster commented 2 years ago

I want to use this script to monitor my MongoDB 5.0.6 ReplicaSet Cluster with 3 nodes. The following checks works on each node:

check_mongodb.py -D -H localhost -A connect -C 10 -W 5 check_mongodb.py -D -H localhost -A memory -C 10 -W 5

Only the following check doesn't work on the current primary node:

check_mongodb.py -D -H localhost -A queries_per_second -C 2000 -W 1500

The output with the errormesage is:

CRITICAL - General MongoDB Error: retryable writes is not supported for unreplicated ns: local.nagios_check, full error: {'index': 0, 'code': 20, 'errmsg': 'retryable writes is not supported for unreplicated ns: local.nagios_check'}

The check works on each secondarynode.

PyMongo ist already available on all nodes.

The usage told me:

-M MONGO_VERSION, --mongoversion=MONGO_VERSION The MongoDB version you are talking with, either 2 or 3

Is this script compatible with mongodb 5?

The ReplicaSet is installed on Ubuntu 20.04.3 LTS systems.

Let me know if you need further information

BR

Napsty commented 1 year ago

@MoBlockbuster Try appending --disable_retry_writes, in your case:

./check_mongodb.py -D -H localhost -A queries_per_second -C 2000 -W 1500 --disable_retry_writes

Ran into this as well (but on MongoDB 4.x). This was fixed in #253 .