nightw / mikoomi-zabbix-mongodb-monitoring

Forked from the mikoomi-templates project from here: https://code.google.com/p/mikoomi but only containing the MongoDB Zabbix Plugin
MIT License
58 stars 68 forks source link

MongoDB Zabbix monitoring plugin

Overview

The MongoDB Plugin can be used to monitor standalone, replicated as well as clustered MongoDB instances with Zabbix. The plugin monitors availability, resource utilization, health, performance and other important metrics of a MongoDB environment. Coupled with the Zabbix OS level monitoring, the MongoDB plugin provides great peace of mind knowing that MongoDB is being monitored 24x7 and sufficient data would be available for sizing, scalability, troubleshooting and support.

Important notes on Zabbix and MongoDB versions

In general: try to use Zabbix and MongoDB versions "close" to each other and use the scripts from the right directory. There will be a merge of versions and only new releases of MongoDB and Zabbix will be supported in some point in time later on, and then hopefully this confusion will be cleared.

Setup and Configuration

The MongoDB plugin uses the MongoDB PHP driver which needs to be installed on the MongoDB node being monitored. For this, install and setup the following packages:

For the above use the right package manager for your distribution (aptitude, yum, etc.)

Now install the php MongoDB driver using the instructions at http://us2.php.net/manual/en/mongo.installation.php

Also you need the mongo PECL package for PHP which can be installed either by the package manager of your distribution or with this PECL command:

pecl install mongo

If you installed MongoDB driver via the PECL command, then you need to enable it for PHP. Edit the PHP configration of the server (e.g.: /etc/php5/cli/php.ini) and make sure the following line is present in it:

extension=mongo.so

Ensure that the php MongoDB driver is setup and configured properly by testing out one of the sample php programs for MongoDB driver (http://us2.php.net/manual/en/mongo.tutorial.php).

Download the MongoDB Plugin shell script and php file from https://github.com/nightw/mikoomi-zabbix-mongodb-monitoring/find/master and copy them into externalscripts (e.g. /etc/zabbix/externalscripts) directory on the MongoDB node you want to monitor. Make sure that the php script and shell script are made executable.

Next open up a browser and download the MongoDB Zabbix template. Now login to the Zabbix frontend (if it still has the default user and password, then it should be Admin/zabbix).

Navigate as follows:

Monitoring a MongoDB Environment (single server, replicaset or cluster)

Follow these steps to start monitoring a MongoDB server

Note that in a sharded and/or replicated MongoDB environment, you need to monitor only ONE of the mongos process. However that process needs to be aware of the entire Mongo environment (or cluster) - i.e. all the shards and all the replicas within each replicaset.

Now data should be collected by the template at intervals of 60 seconds.

If something is wrong (data does not show up in the Zabbix server, etc.) then you should run the script with the -D option for debug mode and then look at the output at /tmp/mikoomi-mongodb-plugin.php_*.log file.

Monitored Metrics

The MongoDB plugin monitors the following metrics or items during each cycle:

Pre-canned Triggers

Triggers in Zabbix are events of interest that happen with respect to the monitored metrics. For example, the plugin keeps track of the total number of collections. If this count changes, it flags this event by firing a trigger. You can choose to ignore this trigger or you can choose to take an action - e.g. send an email or run a shell script.

The MongoDB plugin comes with the following built-in triggers:

Pre-canned Graphs

While Zabbix allows creating graphing one or more monitored metric, the plugin comes with the following pre-canned graphs to get you productive immediately:

MongoDB Cumulative Database Size in MB

MongoDB Memory Footprint: This graph plots the following metrics

MongoDB Database Operations: This graph plots the following metrics

MongoDB Journaling: This graph plots the following metrics