Mailing List Archive

Good way to get varnish statistics?
Hi folks,

What, in your opinion, is a good way to collect statistics from a
varnish instance?

For example, when I want to get frequency about RespStatus, I use varnishtop:

varnishtop -i RespStatus

But it seems that it doesn't give me the "count" value (like
client.req from varnishstats), just the average (?). So I find it
difficult to "plot" this info into my monitoring system (zabbix). It
would be great if it could return the count in a custom period of time
(like 1m) :)

Another way would be parsing the access.log (generated by
varnishncsa), counting lines and sending the value to the monitoring.
But I think this way is bad and lacks performance.

I also came up with this post:
https://jiboumans.wordpress.com/2013/02/27/realtime-stats-from-varnish/

This uses a vmod but it seems to send statistics on every request. THe
post says that there's no much overhead, but the complexity can grow
:)

What do you use or prefer? I doubt I'm the only one that needs this :P

--
[]'s
Hugo
www.devin.com.br

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Good way to get varnish statistics? [ In reply to ]
Hugo,

You can use varnishstat.. See some example scripts below.. These scripts were written when we used mixed varnish versions, hence the the version checking ;)

$ cat /etc/snmp/scripts/NM_VARNISH_TOTALREQS.sh
#!/bin/sh
varnishver=`varnishd -V 2>&1 | head -n 1 | cut -f 2 -d " " | cut -f 2 -d "-" | cut -f 1 -d "."`
if [ $varnishver == '4' ]
then
/usr/bin/varnishstat -1 -f MAIN.client_req | awk '{ print $2 }'
else
/usr/bin/varnishstat -1 -f client_req | awk '{ print $2 }'
fi

$ cat /etc/snmp/scripts/NM_VARNISH_STORAGEUSED.sh
#!/bin/sh
varnishver=`varnishd -V 2>&1 | head -n 1 | cut -f 2 -d " " | cut -f 2 -d "-" | cut -f 1 -d "."`
if [ $varnishver == '4' ]
then
usedmalloc=`/usr/bin/varnishstat -1 -f SMA.s0.g_bytes | awk '{ print $2 }'`
usedfile=`/usr/bin/varnishstat -1 -f SMF.s0.g_bytes | awk '{ print $2 }'`
if [ -z "$usedmalloc" ]; then
usedmalloc=0
fi
if [ -z "$usedfile" ]; then
usedfile=0
fi
used=$(($usedmalloc+$usedfile))
echo $used
else
echo "NaN"
fi

________________________________________
From: varnish-misc-bounces+a.hongens=netmatch.nl@varnish-cache.org <varnish-misc-bounces+a.hongens=netmatch.nl@varnish-cache.org> on behalf of Hugo Cisneiros (Eitch) <hugo.cisneiros@gmail.com>
Sent: Saturday, July 15, 2017 12:29:48 AM
To: varnish-misc@varnish-cache.org
Subject: Good way to get varnish statistics?

Hi folks,

What, in your opinion, is a good way to collect statistics from a
varnish instance?

For example, when I want to get frequency about RespStatus, I use varnishtop:

varnishtop -i RespStatus

But it seems that it doesn't give me the "count" value (like
client.req from varnishstats), just the average (?). So I find it
difficult to "plot" this info into my monitoring system (zabbix). It
would be great if it could return the count in a custom period of time
(like 1m) :)

Another way would be parsing the access.log (generated by
varnishncsa), counting lines and sending the value to the monitoring.
But I think this way is bad and lacks performance.

I also came up with this post:
https://jiboumans.wordpress.com/2013/02/27/realtime-stats-from-varnish/

This uses a vmod but it seems to send statistics on every request. THe
post says that there's no much overhead, but the complexity can grow
:)

What do you use or prefer? I doubt I'm the only one that needs this :P

--
[]'s
Hugo
www.devin.com.br

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc