From 95ced4dd79c93c47518bd27f629d03012fbaa0bb Mon Sep 17 00:00:00 2001 From: Anders Nordby Date: Wed, 19 Sep 2007 16:19:40 +0200 Subject: [PATCH] Initial version --- plugins/other/varnish_allocated | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 plugins/other/varnish_allocated diff --git a/plugins/other/varnish_allocated b/plugins/other/varnish_allocated new file mode 100755 index 00000000..aa61cb41 --- /dev/null +++ b/plugins/other/varnish_allocated @@ -0,0 +1,35 @@ +#! /bin/sh +# anders@fupp.net, 2007-09-19 +# Shows the amount of virtual memory allocated by Varnish for storing cache +# objects + +PATH="$PATH:/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 Virtual memory allocated' + echo 'graph_vlabel memory' + echo 'graph_category varnish' + echo 'graph_info This graph shows the amount of virtual memory allocated by Varnish for storing cache objects' + + echo 'memory.label memory' + echo 'memory.type GAUGE' + echo 'memory.graph yes' + ;; +*) + pvstat memory 'bytes allocated$' + ;; +esac