You may find yourself in the situation where when configuring nagios to monitor a MongoDB, it will complain that:
"CRITICAL - Unable to find host XXXXXXXX in replica set."
And you know for a fact that the replica set is fine. What has gone wrong then?
You have told nagios to monitor the IP address of the host in question, where in the replica set the host is found by its DNS name. Currently nagios-plugin-mongodb does not take this into account.
It’s not the actual nagios-plugin-mongodb python script that needs to take it into account, it is how they suggest you define the command in nagios.
I used $HOSTNAME$ instead of $HSTADDRESS$ in nagios’ command definitions, as this is consistent with the definition of nodes in the replica set, and works like a charm..
Thanks!