forked from basiszwo/munin-varnish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
varnish_hitrate
36 lines (31 loc) · 884 Bytes
/
varnish_hitrate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh
# anders@aftenposten.no, 2007-09-19
# Shows the rate of requests (per second) for Varnish
PATH="$PATH:/opt/varnish/bin:/usr/local/bin"
export PATH
vversion=`varnishstat -V 2>&1 | egrep "^varnishstat" | perl -p -e "s@varnishstat\s*@@;s@\(@@;s@\)@@;s@varnish-@@"`
pvstat() {
# $1: vname $2: grabstat
printf "$1.value "
case $vversion in
1.0*) varnishstat -1 | egrep "$2" | awk '{print $1}';;
*) varnishstat -1 | egrep "$2" | awk '{print $2}';;
esac
}
case $1 in
autoconf) echo yes;;
config)
echo 'graph_title Hitrate'
echo 'graph_vlabel hits per second'
echo 'graph_category varnish'
echo 'graph_info This graph shows the rate of requests, hits per second'
echo 'requests.label requests'
# echo 'requests.type COUNTER'
echo 'requests.type DERIVE'
echo 'requests.min 0'
echo 'requests.graph yes'
;;
*)
pvstat requests 'Client requests received$'
;;
esac