Monitoring Varnish server with Shinken
Varnish is an HTTP accelerator designed for content-heavy dynamic web sites. In contrast to other HTTP accelerators, such as Squid, which began life as a client-side cache, or Apache and nginx, which are primarily origin servers, Varnish was designed as an HTTP accelerator. Varnish is focused exclusively on HTTP, unlike other proxy servers that often support FTP, SMTP and other network protocols.
I am going to show you how to monitor your Varnish server under Ubuntu with Shinken monitoring server.
This post won’t be covering the Shinken installation, I will suppose you got already a Shinken or Nagios server up and running. Check my older post to install Nagios.
On the Varnish server, download and extract the plugin
tar zxvf varnish-nagios-1.1.tar.gz
Installing some dependencies before installing the check_varnish
apt-get install pkg-config libvarnishapi-dev
Now that the installation is done, checkout some options for the script like this
Editing NRPe config file
Adding this line to the config file
command[check_varnish]=/usr/local/libexec/check_varnish -w 25 -c 30
Restarting NRPE service
Use “check_varnish -p ” by using one of the left listed column by “varnishstat -l”
/usr/local/libexec/check_varnish -p client_conn
Client connections accepted (652)|client_conn=652
Now on the Shinken/Nagios server define a new service to the Varnish host
service_description Varnish Cache hit ratio
Checking Shinken configuration
/usr/local/shinken/bin/shinken-arbiter -v -c /usr/local/shinken/etc/nagios.cfg -c /usr/local/shinken/etc/shinken-specific.cfg
If you are using Nagios you might need to do this instead
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Open Shinken or Nagios in your web browser and check “Varnish Cache hit ratio” status