Skip to content

Instantly share code, notes, and snippets.

@bvassilis
Created December 11, 2012 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvassilis/4258962 to your computer and use it in GitHub Desktop.
Save bvassilis/4258962 to your computer and use it in GitHub Desktop.
gather various information regarding varnish
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment