/etc/yum.repos.d/varnish.repo [varnishcache_varnish41] name=varnishcache_varnish41 baseurl=https://packagecloud.io/varnishcache/varnish41/el/6/$basearch repo_gpgcheck=1 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/varnishcache/varnish41/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 OK, ready then yum clean all yum install varnish Check the version: # /usr/sbin/varnishd -V varnishd (varnish-4.1.8 revision d266ac5c6) here is my varnish default configuration /etc/sysconfig/varnish NFILES=131072 MEMLOCK=2000 NPROCS=”unlimited” […]
varnishadm ban
When cleaning the cache on varnish 3.0 there is a way to only ban the specific host. The command is: varnishadm -T localhost:1234 ban req.http.host ~ “site.com” && req.url ~ “/path”
How to get varnish client.ip behind ELB
How to get varnish client.ip behind ELB I needed to filter access by IP using varnish acl, but when your varnish is behind a Amazon ELB Load Balancer, by default it doesn’t work, so here is the solution! Tested using […]
check_varnish_uptime
Simple script to check if the varnish daemon has been restarted latelly Here is the code: #!/bin/bash #Get current varnish uptime #Version 1.0 #By Felipe Ferreira Set 2013 #Variables CRIT=900 #Check arguments print help if [ $# -lt 1 ]; […]
check_backend.sh
Another bash script to monitor if there were any failed connections to the backend’s. It is a simple aproach using the command: varnishstat -1 -f backend_fail Then it puts the output on a tmp file and next time it runs […]
varnish check_hitratio
We need to know if varnish is caching hit ratio is as it should. So I wrote this simple bash plugin for nagios. ./check_hitratio.sh 96 90 OK – 98.67% hit_ratio|hit_ratio=98.67 96 = warning 90 = critical if no arg is […]
Script to purge varnish cache
There is a easy way to allow developers to stop bugging us the system adminsitror, “clean the cache”. Just setup this php page on a apache server and they can do it themselves. Tested on Varnish 2.X using syntax: curl […]