You are reading

Configuring Munin Plugins for Varnish with Git

Posted: December 26, 2009 | By: TJ | In Technology | No comments yet

I’ve been using Varnish as a proxy to Nginx for some time and have really been impressed with some of the performance benefits I’ve seen. Although this site doesn’t generate enough traffic to warrant this type of setup, I’ve wanted to at least monitor and track cache hits and misses for Varnish. Enter Munin.

Munin is a networked resource monitoring tool that can help analyze resource trends and “what just happened to kill our performance?” problems. It is designed to be very plug and play. A default installation provides a lot of graphs with almost no work. For my setup, I’ve got Munin, the grapher/gatherer, running on another (dv) Dedicated Virtual Server from (mt) Media Temple that does all the leg work. Then I’ve got Munin nodes running on a few different servers. The default resources monitored are network throughput, disk usage, MySQL, load, ram, entropy, etc.

To start monitoring Varnish, we’ll need to setup a Munin plugin that is available on GitHub. For this, you’ll need Git:

$ aptitude install git-core

Navigate to your Munin’s plugin directory, usually /usr/share/munin/plugins:

$ cd /usr/share/munin/plugins

Now clone the repository with Git:

$ git clone git://github.com/basiszwo/munin-varnish.git

Now, let’s make things executable:

$ chmod a+x /usr/share/munin/plugins/munin-varnish/varnish_*

Then symlink the new plugins to the configuration directory, usually in /etc/munin:

$ ln -s /usr/share/munin/plugins/munin-varnish/varnish_* /etc/munin/plugins/

For most, this should be your final step. Change your Munin node configuration by adding the following to /etc/munin/plugin-conf.d/munin-node:

[varnish*]
user root

Restart the Munin node daemon and check the munin-node.log for errors:

$ /etc/init.d/munin-node restart
$ tail -f /var/log/munin/munin-node.log

Not so fast. You’re missing a Perl module:

Can't locate Net/Telnet.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /etc/munin/plugins/varnish_varnishstat_ line 2.

No problem. Let’s install the Net::Telnet Perl module:

$ wget http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3.03.tar.gz
$ tar -zxvf Net-Telnet-3.03.tar.gz
$ cd Net-Telnet-3.03
$ perl Makefile.PL
$ make
$ make test
$ make install

If the module is installed successfully, you should restart Munin node again and check for pretty graphs:

Varnish Graph

Varnish Graph

Leave your comment



Copyright © 2010. All rights reserved.

This blog is powered by WordPress and proudly hosted by (mt) Media Temple.