]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/squid_delay_pools_noreferer
Add a new Squid graph to count the IPs being delayed due to no-referer, and restrict...
[chef.git] / cookbooks / munin / files / default / plugins / squid_delay_pools_noreferer
diff --git a/cookbooks/munin/files/default/plugins/squid_delay_pools_noreferer b/cookbooks/munin/files/default/plugins/squid_delay_pools_noreferer
new file mode 100644 (file)
index 0000000..a35da11
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Plugin to monitor the number of IPs being slowed down by Squid delay pools
+# This monitors the number of IPs being delayed in the first 128 pools, which
+# are the ones which have no referer.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#
+
+if [ "$1" = "config" ]; then
+
+       echo 'graph_title No-referer IPs being delayed'
+       echo 'graph_args --base 1000 -l 0'
+       echo 'graph_vlabel IPs'
+       echo 'graph_category squid'
+       echo 'squid_delay2.label IPs'
+       echo 'squid_delay2.min 0'
+       echo 'squid_delay2.draw AREA'
+
+       exit 0
+fi
+
+req0=`squidclient -h 127.0.0.1 mgr:delay|awk '\$1 == "Pool:"  && \$2 < 128 { pr = 1; } \$1 == "Pool:" && \$2 >= 128 { pr = 0; } { if (pr) { print \$0; } }'|fgrep Current|egrep --count '[0-9]{1,3}:-?[0-9]{1,3} '`
+
+echo "squid_delay2.value " `expr 0 + $req0`