Getting a Grip on your Operations with Munin

by on January 18, 2009 · 5 comments

Have you ever taken a midnight drive down a dirt road without any headlights on? While its certainly a thrilling (and stupid) thing to do, I certainly wouldn’t recommend doing the same thing with your data center. Do you have any idea if the load your servers experienced this morning was unusually high? Could you tell me how many MySQL “slow queries” were executed on your database yesterday? Have customers and co-workers praised you for your website’s performance?

If you answered “No” to any of these questions, I’d like to introduce you to a new friend – Munin. Munin is an open source, server load analysis tool. It uses Tobi Oetiker’s outstanding RRDtool for “real time” (at least within 5 minutes per default config) server information.

Installation and configuration is a breeze under Debian:

sudo apt-get install munin munin-node

‘munin’ is the server application, so you’ll only need to install ‘munin-node’ on the client machines.

Now, let’s configure the master instance ( by identifying the client nodes it should poll:

[email protected]:~$ sudo vi /etc/munin/munin.conf
# a simple host tree
    use_node_name yes
    use_node_name yes
    use_node_name yes

For more detailed info check out how to configure the Munin master.

Setup the client node by instructing it which interface(s) it should collect data on (this will be the same IP as entered in the master config above) and which master(s) are allowed to poll:

[email protected]:~$ sudo vi /etc/munin/munin-node.conf 
# Which port to bind to
allow ^$

Check out the official node configuration page for more details. And remember to restart the client nodes after setup so they start writing data by:

[email protected]:~$ sudo /etc/init.d/munin-node restart
Stopping Munin-Node: done.
Starting Munin-Node: done.

Wait five minutes or so and then check the master data files:

[email protected]:$ less /var/lib/munin/munin-update.stats

After setting up a virtual host pointing to our master (DocumentRoot /var/www/munin), I had instant data pr0n:

While it helps to have all the servers within the same network, any intervening firewalls can be setup to allow the Munin master connection to the client nodes on port 4949. Check out the Munin Monitoring Wiki page for even more helpful tips and tricks!

Munin also has basic monitoring support, but there’s also a Nagios plugin available to send alerts through Nagios. Together, Munin and Nagios go a long way towards helping you get your data center under control allowing you to do real capacity planning.

“Happy Hunting” and remember to share any interesting graphs (or successful optimizations) on the flickr Web Ops Visualization Pool!

Did you enjoy this article? Get new articles for free by email: