]> git.openstreetmap.org Git - chef.git/commitdiff
Add a new Squid graph to count the IPs being delayed due to no-referer, and restrict...
authorMatt Amos <zerebubuth@gmail.com>
Sun, 14 Aug 2016 19:27:59 +0000 (20:27 +0100)
committerMatt Amos <zerebubuth@gmail.com>
Sun, 14 Aug 2016 19:28:47 +0000 (20:28 +0100)
cookbooks/munin/files/default/plugins/squid_delay_pools
cookbooks/munin/files/default/plugins/squid_delay_pools_noreferer [new file with mode: 0644]
cookbooks/squid/recipes/default.rb

index 35e58956b8e98559af2939add8cb441895d324a4..13499545c4df4e60440141f373555cca6503e36a 100755 (executable)
@@ -1,8 +1,10 @@
 #!/bin/sh
 #
 # Plugin to monitor the number of IPs being slowed down by Squid delay pools
 #!/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 last 128 pools, which
+# are the normal requests.
 #
 #
-# Parameters: 
+# Parameters:
 #
 #      config   (required)
 #      autoconf (optional - used by munin-config)
 #
 #      config   (required)
 #      autoconf (optional - used by munin-config)
@@ -10,7 +12,7 @@
 
 if [ "$1" = "config" ]; then
 
 
 if [ "$1" = "config" ]; then
 
-       echo 'graph_title IPs being delayed'
+       echo 'graph_title IPs being delayed with referer'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel IPs'
        echo 'graph_category squid'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel IPs'
        echo 'graph_category squid'
@@ -21,7 +23,6 @@ if [ "$1" = "config" ]; then
        exit 0
 fi
 
        exit 0
 fi
 
-req0=`squidclient -h 127.0.0.1 mgr:delay|fgrep Current|egrep --count '[0-9]{1,3}:-?[0-9]{1,3} '`
+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} '`
 
 echo "squid_delay1.value " `expr 0 + $req0`
 
 echo "squid_delay1.value " `expr 0 + $req0`
-
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`
index e665d57e351bb6c856eed755db38619b50349789..d1b2f71f81f41d23c74d7972d9d77211f2afe540 100644 (file)
@@ -77,6 +77,7 @@ end
 
 munin_plugin "squid_cache"
 munin_plugin "squid_delay_pools"
 
 munin_plugin "squid_cache"
 munin_plugin "squid_delay_pools"
+munin_plugin "squid_delay_pools_noreferer"
 munin_plugin "squid_times"
 munin_plugin "squid_icp"
 munin_plugin "squid_objectsize"
 munin_plugin "squid_times"
 munin_plugin "squid_icp"
 munin_plugin "squid_objectsize"