Monitoring Varnish cache with Zabbix

Varnish is a very powerfull Open Source caching solution that is very popular on Linux.  Using varnishstat, it can give very richt monitoring statistics to Zabbix.

Just create a file with these lines in your zabbix_agent.conf.d directory:

# Varnish Keys
UserParameter=varnish.stat[*],(test -f /usr/bin/varnishstat && varnishstat -1 -f $1 | awk '{print $$2}')
UserParameter=varnish.sick,(/usr/bin/varnishadm |grep Sick|wc -l)


This will make all varnishstat entries available as varnishstat[<item>] to zabbix and another key called varnish.sick to get the number of backends that went dead.

With the keys available, you can just make normal agent checks that get the information required. Here are some interesting examples:

  • varnish.stat[MAIN.backend_conn]
  • varnish.stat[MAIN.cache_hit]
  • varnish.stat[MAIN.cache_miss]
  • varnish.stat[MAIN.client_req]
  • varnish.stat[MAIN.n_backend]
  • varnish.stat[MAIN.sess_conn]

Using a combination of varnish.sick and n_backend, you can make a trigger that fires if for example more then 50% of your frontends fail:


If you want more information on how to implement varnish in your company or organization, please contact us.