You Are Here: Home » HowTos » Monitoring Varnish server with Shinken

Monitoring Varnish server with Shinken

varnishstat

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.

Check_varnish

On the Varnish server, download and extract the plugin
cd /usr/src/
wget http://repo.varnish-cache.org/source/varnish-nagios-1.1.tar.gz
tar zxvf varnish-nagios-1.1.tar.gz
cd varnish-nagios-1.1

Installing some dependencies before installing the check_varnish
apt-get install pkg-config libvarnishapi-dev
./configure
make
make install

Now that the installation is done, checkout some options for the script like this
/usr/local/libexec/check_varnish -help
Editing NRPe config file
vim /etc/nagios/nrpe.cfg
Adding this line to the config file
command[check_varnish]=/usr/local/libexec/check_varnish -w 25 -c 30
Restarting NRPE service
/etc/init.d/nagios-nrpe-server restart
Use “check_varnish -p ” by using one of the left listed column by “varnishstat -l”
Ex:
/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
/usr/local/shinken/etc/services/Linux_nrpe.cfg
define service{
service_description Varnish Cache hit ratio
host_name VarnishServerName
use generic-service
check_command check_nrpe!check_varnish
}

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
Restarting Shinken
/etc/init.d/shinken restart
Open Shinken or Nagios in your web browser and check “Varnish Cache hit ratio” status

Varnish status Thruk

Varnish status Thruk

Varnish status Shinken

Varnish status Shinken

Source:

Clip to Evernote

About The Author

Network and system engineer

Number of Entries : 44

Leave a Comment


2 × five =

Scroll to top