Posted on 2010-07-09
Varnish_gather is a small script I've written (just now) to gather various information regarding varnish to make it easier to send possibly relevant information to the people who can help you with varnish.
The official location is: http://bohemians.org/~kristian/varnish/varnish_gather (http://bohemians.org/~kristian/varnish/varnish_gather) . The usage is simple: Download it, make it executable, then run it. It does not require root privileges, and supplying the admin port is optional.
./varnish_gather > varnish_info.log
./varnish_gather localhost:6082 > varnish_info2.log
Only intended for Debian/Ubuntu and Red Hat variants of GNU/Linux for now. Patches are welcome.
That's it.
For reference, heres a copy of the version available when I post this:
#!/bin/sh # varnish_gather - Gather debug information for varnish issues # Copyright (C) 2010 Kristian Lyngstol # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # # # Mostly harmless. if [ -z "$1" ]; then echo 1>&2 "WARNING: Without a hostname:port for the admin interface, this script is less useful" echo 1>&2 "Typical usage: ./varnish_gather localhost:6082" sleep 5; fi ITEM=0 banner() { echo "--------------------------------" echo "Item $ITEM: $*" echo ITEM=$(( $ITEM + 1 )) } mycat() { if [ -r $1 ]; then banner "File: $1" cat $1 fi } banner dmesg dmesg banner logs mycat /var/log/dmesg for a in /var/log/messages /var/log/syslog; do if [ -r $a ]; then banner "Filtered log: $a" grep varnish $a fi done mycat /proc/cpuinfo mycat /proc/version banner Memory usage free -m banner Vmstat 5x5 vmstat 5 5 banner Process scan ps aux | egrep '(varnish|apache|mysql|nginx)' banner varnishstat varnishstat -1 if [ ! -z "$2" ]; then banner "varnishstat for $2" varnishstat -1 -n $2; fi banner mount mount banner netstat netstat -nlpt banner netstat2 netstat -np mycat /etc/default/varnish mycat /etc/sysconfig/varnish banner "Local files" find /usr/local -name varnish if [ ! -z $1 ]; then banner "Varnishadm tinkering" varnishadm -T $1 vcl.list varnishadm -T $1 vcl.show boot varnishadm -T $1 param.show varnishadm -T $1 purge.list else banner "NO ADMINPORT SUPPLIED" fi banner "End"