Getting a Grip on your Operations with Munin

Ever taken a midnight drive down a dirt road without any headlights on? While it’s certainly a thrilling (and stupid) thing to do, you shouldn’t do it with your data center. But do you know what the load of your web servers were this morning? 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 an old 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:

dan@$ 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:

dan@$ 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:

dan@$ 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:

dan@$ 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, and there’s a Nagios plugin available to send alerts. Together, Munin and Nagios go a long way towards helping get your data center under control by allowing you to do real capacity planning. For network usage, check out John Kimball’s overview on free bandwidth monitors.

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

5 thoughts on “Getting a Grip on your Operations with Munin

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 )

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.