nagios: “CRITICAL – Unable to find host ‘” + host + “‘ in replica set.”

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.

2 thoughts on “nagios: “CRITICAL – Unable to find host ‘” + host + “‘ in replica set.”

  1. 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..

    define command {
        command_name    check_mongodb
        command_line    $USER1$/ -H $HOSTNAME$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s