Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / varnish / varnish_total_objects @ 9791e321

Historique | Voir | Annoter | Télécharger (796 octets)

1
#! /bin/sh
2
# anders@aftenposten.no, 2007-05-08
3
# Shows the total number of objects in Varnish cache
4

    
5
PATH="$PATH:/usr/local/bin"
6
export PATH
7

    
8
vversion=`varnishstat -V 2>&1 | egrep "^varnishstat" | perl -p -e "s@varnishstat\s*@@;s@\(@@;s@\)@@;s@varnish-@@"`
9

    
10
pvstat() {
11
	# $1: vname $2: grabstat
12
	printf "$1.value "
13
	case $vversion in
14
	1.0*) varnishstat -1 | egrep "$2" | awk '{print $1}';;
15
	*) varnishstat -1 | egrep "$2" | awk '{print $2}';;
16
	esac
17
}
18

    
19
case $1 in
20
autoconf) echo yes;;
21
config)
22
	echo 'graph_title Objects'
23
	echo 'graph_vlabel objects'
24
	echo 'graph_category varnish'
25
	echo 'graph_info This graph shows the total number of objects in Varnish cache'
26

    
27
	echo 'objects.label objects'
28
	echo 'objects.type GAUGE'
29
	echo 'objects.graph yes'
30
	;;
31
*)
32
	pvstat objects 'N struct object$'
33
	;;
34
esac