]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/squid_delay_pools
Merge remote-tracking branch 'github/pull/79'
[chef.git] / cookbooks / munin / files / default / plugins / squid_delay_pools
1 #!/bin/sh
2 #
3 # Plugin to monitor the number of IPs being slowed down by Squid delay pools
4 # This monitors the number of IPs being delayed in the last 128 pools, which
5 # are the normal requests.
6 #
7 # Parameters:
8 #
9 #       config   (required)
10 #       autoconf (optional - used by munin-config)
11 #
12
13 if [ "$1" = "config" ]; then
14
15         echo 'graph_title IPs being delayed with referer'
16         echo 'graph_args --base 1000 -l 0'
17         echo 'graph_vlabel IPs'
18         echo 'graph_category squid'
19         echo 'squid_delay1.label IPs'
20         echo 'squid_delay1.min 0'
21         echo 'squid_delay1.draw AREA'
22
23         exit 0
24 fi
25
26 req0=`squidclient -h 127.0.0.1 mgr:delay|awk '\$1 == "Pool:"  && \$2 < 128 { pr = 0; } \$1 == "Pool:" && \$2 >= 128 { pr = 1; } { if (pr) { print \$0; } }'|fgrep Current|egrep --count '[0-9]{1,3}:-?[0-9]{1,3} '`
27
28 echo "squid_delay1.value " `expr 0 + $req0`