Remove outdated varnish3 plugins, point to upstream version
This commit is contained in:
parent
bcb9ed82ea
commit
47e34fdf83
|
@ -0,0 +1,6 @@
|
|||
Varnish plugins
|
||||
---------------
|
||||
|
||||
Updated Varnish plugins for 3.x can be found in the
|
||||
main munin source code repository.
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#! /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
|
|
@ -1,183 +0,0 @@
|
|||
#! /usr/bin/perl
|
||||
# Varnish cache hit ratio logger/plugin
|
||||
# anders@fupp.net, 2007-09-19
|
||||
|
||||
# Log/data file
|
||||
# These must have write permission to the user the plugin runs as
|
||||
# On FreeBSD, that is nobody
|
||||
# Comment $mylog out to skip logging
|
||||
|
||||
# Set to 1 if you want to show unknown requsts (client requests which are
|
||||
# neither hits nor misses):
|
||||
$showunknown = 1;
|
||||
|
||||
$mydat = "/var/tmp/varnish_cachehitratio.dat";
|
||||
#$mylog = "/var/log/varnish_cachehitratio.log";
|
||||
|
||||
%stat = ();
|
||||
$ENV{PATH} = "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin";
|
||||
open(VV, "varnishstat -V 2>&1 |");
|
||||
while (<VV>) {
|
||||
if (/^varnishstat/) { $vversion = $_; }
|
||||
}
|
||||
close(VV);
|
||||
chomp($vversion);
|
||||
$vversion =~ s@varnishstat\s*@@;
|
||||
$vversion =~ s@\(@@;
|
||||
$vversion =~ s@\)@@;
|
||||
$vversion =~ s@varnish-@@;
|
||||
|
||||
use Date::Format;
|
||||
|
||||
sub popstat10 {
|
||||
foreach $line (`varnishstat -1`) {
|
||||
chomp($line);
|
||||
if ($line =~ /^\s+(\d+)\s+(.*)$/) {
|
||||
$val = $1;
|
||||
$key = $2;
|
||||
$key =~ s@\s@_@g;
|
||||
$key =~ tr@A-Z@a-z@;
|
||||
|
||||
$stat{"$key"} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub popstat {
|
||||
foreach $line (`varnishstat -1`) {
|
||||
chomp($line);
|
||||
if ($line =~ /^\w+\s+(\d+)\s+[\d\.]+\s+(.*)$/) {
|
||||
$val = $1;
|
||||
$key = $2;
|
||||
$key =~ s@\s@_@g;
|
||||
$key =~ tr@A-Z@a-z@;
|
||||
|
||||
$stat{"$key"} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub printconfig {
|
||||
print "graph_title Cache hit/miss ratio\n";
|
||||
print "graph_args --upper-limit 100 -l 0\n";
|
||||
print "graph_vlabel % of requests\n";
|
||||
print "graph_category varnish\n";
|
||||
print "graph_info This graph shows the ratio of requests found in the cache and not\n";
|
||||
if ($showunknown) {
|
||||
print "graph_order hitratio missratio unknownratio\n";
|
||||
} else {
|
||||
print "graph_order hitratio missratio\n";
|
||||
}
|
||||
print "graph_scale no\n";
|
||||
|
||||
print "hitratio.label hits\n";
|
||||
print "hitratio.type GAUGE\n";
|
||||
print "hitratio.graph yes\n";
|
||||
print "hitratio.min 0\n";
|
||||
print "hitratio.max 100\n";
|
||||
print "hitratio.draw AREA\n";
|
||||
|
||||
print "missratio.label misses\n";
|
||||
print "missratio.type GAUGE\n";
|
||||
print "missratio.graph yes\n";
|
||||
print "missratio.min 0\n";
|
||||
print "missratio.max 100\n";
|
||||
print "missratio.draw STACK\n";
|
||||
|
||||
if ($showunknown) {
|
||||
print "unknownratio.label unknown\n";
|
||||
print "unknownratio.type GAUGE\n";
|
||||
print "unknownratio.graph yes\n";
|
||||
print "unknownratio.min 0\n";
|
||||
print "unknownratio.max 100\n";
|
||||
print "unknownratio.draw STACK\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub findvalues {
|
||||
$nrequests = (defined $stat{"client_requests_received"}) ? $stat{"client_requests_received"} : 0;
|
||||
$nhits = (defined $stat{"cache_hits"}) ? $stat{"cache_hits"} : 0;
|
||||
$nmisses = (defined $stat{"cache_misses"}) ? $stat{"cache_misses"} : 0;
|
||||
|
||||
open(OVAL, $mydat);
|
||||
$tmpstr = <OVAL>;
|
||||
close(OVAL);
|
||||
chomp($tmpstr);
|
||||
|
||||
($orequests,$ohits,$omisses) = split(/ /, $tmpstr, 3);
|
||||
|
||||
$hits = $nhits - $ohits;
|
||||
$requests = $nrequests - $orequests;
|
||||
$misses = $nmisses - $omisses;
|
||||
}
|
||||
|
||||
sub printvalues {
|
||||
if ($requests > 0) {
|
||||
$hitratio = sprintf("%.2f", $hits / $requests * 100);
|
||||
$missratio = sprintf("%.2f", $misses / $requests * 100);
|
||||
} else {
|
||||
# Assume cache hit ratio = 100% if requests < 0
|
||||
$hitratio = sprintf("%.2f", 100);
|
||||
$missratio = sprintf("%.2f", 0);
|
||||
}
|
||||
|
||||
if ($hits > 0 || $misses > 0) {
|
||||
$xhitratio = sprintf("%.2f", $hits / ($hits+$misses)*100);
|
||||
$xmissratio = sprintf("%.2f", $misses / ($hits+$misses)*100);
|
||||
} else {
|
||||
$xhitratio = sprintf("%.2f", 100);
|
||||
$xmissratio = sprintf("%.2f", 0);
|
||||
}
|
||||
|
||||
if (($hitratio + $missratio) > 100) {
|
||||
# Rounding foo, hit+miss ratio is higher than 100
|
||||
$missratio = sprintf("%.2f", 100 - $hitratio);
|
||||
$unknownratio = sprintf("%.2f", 0);
|
||||
} else {
|
||||
# Unknown = rest, hit+miss ratio is upto or 100
|
||||
$unknownratio = sprintf("%.2f", 100 - ($hitratio + $missratio));
|
||||
}
|
||||
|
||||
if ($showunknown) {
|
||||
print "hitratio.value $hitratio\n";
|
||||
} else {
|
||||
print "hitratio.value $xhitratio\n";
|
||||
}
|
||||
print "missratio.value $missratio\n";
|
||||
|
||||
if ($showunknown) {
|
||||
print "unknownratio.value $unknownratio\n";
|
||||
}
|
||||
if ($mylog ne "") {
|
||||
open(LOG, ">>$mylog");
|
||||
if ($showunknown) {
|
||||
print LOG "hitratio=$hitratio missratio=$missratio unknown=$unknownratio hits=$hits misses=$misses requests=$requests [" . time2str("%Y-%m-%d %H:%M:%S", time) . "]\n";
|
||||
} else {
|
||||
print LOG "hitratio=$hitratio missratio=$missratio hits=$hits misses=$misses requests=$requests [" . time2str("%Y-%m-%d %H:%M:%S", time) . "]\n";
|
||||
}
|
||||
close(LOG);
|
||||
}
|
||||
}
|
||||
|
||||
sub writevalues {
|
||||
open(OVAL, ">$mydat");
|
||||
# xhitratio is hitratio considering only hits and misses, not client
|
||||
# requests
|
||||
print OVAL "$nrequests $nhits $nmisses $hitratio $xhitratio\n";
|
||||
close(OVAL);
|
||||
}
|
||||
|
||||
if ($ARGV[0] eq "autoconf") {
|
||||
print "yes\n";
|
||||
} elsif ($ARGV[0] eq "config") {
|
||||
printconfig;
|
||||
} else {
|
||||
if ($vversion =~ /^1\.0/) {
|
||||
popstat10;
|
||||
} else {
|
||||
popstat;
|
||||
}
|
||||
findvalues;
|
||||
printvalues;
|
||||
writevalues;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
#Plugin to monitor the number of healthy and sick backends
|
||||
#
|
||||
#
|
||||
|
||||
ADMINSERVER=127.0.0.1
|
||||
ADMINPORT=2000
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Number of Healthy Backends'
|
||||
echo 'graph_vlabel number of backends'
|
||||
echo 'graph_category varnish'
|
||||
echo 'graph_info This graph shows the number of healthy backends in the system.'
|
||||
echo 'healthy.label Healthy'
|
||||
echo 'healthy.warning 2:'
|
||||
echo 'healthy.critical 1:'
|
||||
echo 'sick.label Sick'
|
||||
exit 0
|
||||
fi
|
||||
healthyServers=`varnishadm -T ${ADMINSERVER}:${ADMINPORT} debug.health 2>&1 | grep 'is Healthy' | wc -l`
|
||||
sickServers=`varnishadm -T ${ADMINSERVER}:${ADMINPORT} debug.health 2>&1 | grep 'is sick' | wc -l`
|
||||
echo "healthy.value ${healthyServers}"
|
||||
echo "sick.value ${sickServers}"
|
|
@ -1,36 +0,0 @@
|
|||
#! /bin/sh
|
||||
# anders@aftenposten.no, 2007-09-19
|
||||
# Shows the rate of requests (per second) for Varnish
|
||||
|
||||
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 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
|
|
@ -1,34 +0,0 @@
|
|||
#! /bin/sh
|
||||
# anders@aftenposten.no, 2007-05-08
|
||||
# Shows the total number of objects in Varnish cache
|
||||
|
||||
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 Objects'
|
||||
echo 'graph_vlabel objects'
|
||||
echo 'graph_category varnish'
|
||||
echo 'graph_info This graph shows the total number of objects in Varnish cache'
|
||||
|
||||
echo 'objects.label objects'
|
||||
echo 'objects.type GAUGE'
|
||||
echo 'objects.graph yes'
|
||||
;;
|
||||
*)
|
||||
pvstat objects 'N struct object$'
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue