Munin configuration examples

Overview

Munin can use be used for monitoring aspects of a running system. The following is a mini tutorial to help you set up and use the MongoDB plugin with munin.

Setup

Munin is made up of two components

  • agent and plugins that are installed on the system you want to monitor
  • server which polls the agent(s) and creates the basic web pages and graphs to visualize the data

Install

You can download from SourceForge , but prebuilt packages are also available. For example on Ubuntu you can do the following:

Agent install

To install the agent, repeat the following steps on each node you want to monitor.

shell> sudo apt-get install munin-node

Server install

The server needs to be installed once. It relies on apache2, so you will need to ensure that it is installed as well.

shell> apt-get install apache2
shell> apt-get install munin

Configuration

Both the agent(s) and server need to be configured with the IP address and port to contact each other. In the following examples we will use these nodes:

  • db1 : 10.202.210.175
  • db2 : 10.203.22.38
  • munin-server : 10.194.102.70

Agent configuration

On each node, add an entry as follows into
for db1:

/etc/munin/munin-node.conf
host_name db1-ec2-174-129-52-161.compute-1.amazonaws.com
allow ^10\.194\.102\.70$

for db2:

/etc/munin/munin-node.conf
host_name db2-ec2-174-129-52-161.compute-1.amazonaws.com
allow ^10\.194\.102\.70$

* host_name : can be whatever you like, this name will be used by the server

  • allow : this is the IP address of the server, enabling the server to poll the agent

Server configuration

Add an entry for each node that is being monitored as follows in

[db1-ec2-174-129-52-161.compute-1.amazonaws.com]
address 10.202.210.175
use_node_name no

[db2-ec2-184-72-191-169.compute-1.amazonaws.com]
address 10.203.22.38
use_node_name no

* the name in between the [] needs to match the name set in the agents munin-node.conf

  • address :  IP address of the node where the agent is running
  • use_node_name : dtermine if the IP or the name between [] is used to contact the agent

MongoDB munin plugin

A plugin is available that provide metrics for

  • B-Tree stats
  • Current connections
  • Memory usage
  • Database operations (inserts, updates, queries etc.)

The plugin can be installed as follows on each node where MongoDB is running

shell> wget http://github.com/erh/mongo-munin/tarball/master
shell> tar xvf erh-mongo-munin-*tar.gz
shell> cp erh-mongo-munin-*/mongo_* /etc/munin/plugins/

Check your setup

After installing the plugin and making the configuration changes, force the server to update the information to check your setup is correct using the following

shell> sudo -u munin /usr/share/munin/munin-update

If everything is set up correctly, you will get a chart like this

Advanced charting

If you are running a large MongoDB cluster, you may want to aggregate the values (e.g. inserts per second) across all the nodes in the cluster. Munin provides a simple way to aggregate.

/etc/munin/munin.conf
[compute-1.amazonaws.com;CLUSTER]
update no

* Defines a new segment called CLUSTER

  • update no : munin can generate the chart based on existing data, this tell munin not to poll the agents for the data

Now lets define a chart to aggregate the inserts, updates and deletefor the cluster

cluster_ops.graph_title Cluster Ops
cluster_ops.graph_category mongodb
cluster_ops.graph_total total
cluster_ops.total.graph no
cluster_ops.graph_order insert update delete
cluster_ops.insert.label insert
cluster_ops.insert.sum \
  db1-ec2-174-129-52-161.compute-1.amazonaws.com:mongo_ops.insert \
  db2-ec2-184-72-191-169.compute-1.amazonaws.com:mongo_ops.insert
cluster_ops.update.label update
cluster_ops.update.sum \
  db1-ec2-174-129-52-161.compute-1.amazonaws.com:mongo_ops.update \
  db2-ec2-184-72-191-169.compute-1.amazonaws.com:mongo_ops.update
cluster_ops.delete.label delete
cluster_ops.delete.sum \
  db1-ec2-174-129-52-161.compute-1.amazonaws.com:mongo_ops.delete \
  db2-ec2-184-72-191-169.compute-1.amazonaws.com:mongo_ops.delete

* cluster_ops : name of this chart

  • cluster_ops.graph_category mongodb : puts this chart into the "mongodb" category. Allows you to collect similar charts on a single page
  • cluster_ops.graph_order insert update delete : indicates the order of the line son the key for the chart
  • cluster_ops.insert : represents a single line on the chart, in this case the "insert"
  • cluster_ops.insert.sum : indicates the values are summed
    • db1-ec2-174-129-52-161.compute-1.amazonaws.com : indicates the node to aggregate
    • mongo_ops.insert : indicates the chart (mongo_ops) and the counter (insert) to aggregate

And this is what it looks like

Follow @mongodb

MongoDB Pittsburgh - May 15
MongoNYC - May 23
MongoDB Paris - Jun 14
MongoDB UK - Jun 20
MongoDC - June 26


Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.

blog comments powered by Disqus