/nagios_plugin_mongodb_errmsg

Plugin for Nagios which checks the errmsg of all nodes in a replication set. Can also be used with nrpe or directly out of the shell

Nagios-MongoDB (errmsg)

Overview

This is a simple Nagios check script to monitor your MongoDB servers errmsg specially if your setup is a replication setup (replset) . It checks the output of rs.status command and reports the status of each errmsg field corresponding to the node to which it belongs...

Installation

In your Nagios plugins directory run

git clone git://github.com/traveliq/nagios_plugin_mongodb_errmsg.git

Usage

Install in Nagios

Edit your commands.cfg and add the following


define command {
           command_name    check_mongo_errmsg
           command_line    /usr/local/nagios/libexec/check_mongo_errmsg $HOSTADDRESS$ $ARG1$ $ARG2$ 
}

Where ARG1 is for warning and ARG2 for critical. Both are optional values - defaults are:

WARNING = 1 CRITICAL = 2

Then you can reference it like the following. This is is my services.cfg

Check Connection

This will check each host that is listed in the Mongo Servers group. It will issue a warning if one of the nodes reports a error message and a critical error there are 2 or more reported errors.


define service {
              use                     generic-service
              host_name               Mongo Server
              service_description     MongoDB errmsg
              check_command           check_mongo_errmsg!1!2
}