summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2008-07-24 12:43:13 +0000
committermh <mh@immerda.ch>2008-07-24 12:43:13 +0000
commit29a5ca00bb10b81598d8e64c9e31de15ac462322 (patch)
tree295d1b61a407a1d46ebdecee6ac2eb084f712bc0
parentb230d75f5a8ecacaff7b4ddd7e4ca9bafa8a2b87 (diff)
we now let run a normal squid on 127.0.0.1:3128, so plugins don't need anymore a config. added a new plugin
-rw-r--r--files/munin/squid_efficiency65
-rw-r--r--manifests/munin.pp18
2 files changed, 70 insertions, 13 deletions
diff --git a/files/munin/squid_efficiency b/files/munin/squid_efficiency
new file mode 100644
index 0000000..fdc820a
--- /dev/null
+++ b/files/munin/squid_efficiency
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+# Copyright (C) 2006 Benjamin Schweizer. All rights reserved.
+#
+#
+# Abstract
+# ~~~~~~~~
+# munin plugin that logs the cache efficiency
+#
+# Authors
+# ~~~~~~~
+# Benjamin Schweizer <code at benjamin-schweizer dot de>
+#
+# Changes
+# ~~~~~~~
+# 2006-11-16, schweizer: removed 5 minutes stats, fixed 5% bug
+# 2006-10-26, schweizer: excluded negative values from result
+# 2006-10-11, schweizer: initial release.
+#
+# Todo
+# ~~~~
+# - we'll see
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+
+if [ "$1" = "autoconf" ]; then
+ SQUID_STATS=`printf "GET cache_object://localhost/info HTTP/1.0\n\n" | netcat localhost 3128`
+ if [ -n "${SQUID_STATS}" ]; then
+ echo yes
+ exit 0
+ else
+ echo "no (HTTP GET failed)"
+ exit 1
+ fi
+fi
+
+if [ "$1" = "config" ]; then
+ echo 'graph_title Squid Efficiency'
+ echo 'graph_info This graph shows the proxy efficiency.'
+ echo 'graph_category squid'
+ echo "graph_args --lower-limit 0 --upper-limit 100"
+ echo 'graph_vlabel %'
+
+ echo 'request.label request hit'
+
+ echo 'byte.label byte hit'
+
+ exit 0
+fi
+
+SQUID_STATS=`printf "GET cache_object://localhost/info HTTP/1.0\n\n" | netcat localhost 3128`
+# Request Hit Ratios: 5min: 0.0%, 60min: 17.4%
+# Byte Hit Ratios: 5min: 75.0%, 60min: 12.0%
+
+SQUID_REQUEST_HIT=`echo "$SQUID_STATS" | grep "Request Hit Ratios" | cut -d ":" -f4 | cut -d "." -f1 | xargs echo`
+if [ ${SQUID_REQUEST_HIT} -lt 1 ]; then SQUID_REQUEST_HIT=0; fi
+SQUID_BYTE_HIT=`echo "$SQUID_STATS" | grep "Byte Hit Ratios" | cut -d ":" -f4 | cut -d "." -f1 | xargs echo`
+if [ ${SQUID_BYTE_HIT} -lt 1 ]; then SQUID_BYTE_HIT=0; fi
+
+echo "request.value ${SQUID_REQUEST_HIT}"
+echo "byte.value ${SQUID_BYTE_HIT}"
+
+# eof.
diff --git a/manifests/munin.pp b/manifests/munin.pp
index 2cc44ec..81317fe 100644
--- a/manifests/munin.pp
+++ b/manifests/munin.pp
@@ -1,17 +1,9 @@
# manifests/munin.pp
class squid::munin {
- $real_squid_munin_ip = $squid_munin_ip ? {
- '' => $ipaddress,
- default => $squid_munin_ip
- }
- $real_squid_munin_port = $squid_munin_port ? {
- '' => 3128,
- default => $squid_munin_port
- }
-
- munin::plugin{ 'squid_cache': config => "user root\nenv.squidhost ${ipaddress}\nenv.squidport ${real_squid_munin_port}"}
- munin::plugin{ 'squid_icp': config => "user root\nenv.squidhost ${ipaddress}\nenv.squidport ${real_squid_munin_port}"}
- munin::plugin{ 'squid_requests': config => "user root\nenv.squidhost ${ipaddress}\nenv.squidport ${real_squid_munin_port}"}
- munin::plugin{ 'squid_traffic': config => "user root\nenv.squidhost ${ipaddress}\nenv.squidport ${real_squid_munin_port}"}
+ munin::plugin{ 'squid_cache': }
+ munin::plugin{ 'squid_icp': }
+ munin::plugin{ 'squid_requests': }
+ munin::plugin{ 'squid_traffic': }
+ munin::remoteplugin{ 'squid_efficiency': source => "puppet://$server/squid/munin/squid_efficiency" }
}