-
-
Save jakeyr/2494629 to your computer and use it in GitHub Desktop.
Collectd script for squid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Steps for turning on squid monitoring (until I have an rpm) | |
cat > /etc/collectd/conf/squid << EOF | |
LoadPlugin exec | |
<Plugin exec> | |
Exec deploy "/var/lib/releng/monitoring/squid" | |
</Plugin> | |
EOF | |
mkdir -p /var/lib/releng/monitoring | |
cat > /var/lib/releng/monitoring/squid << EOF | |
#!/bin/sh | |
INTERVAL=${COLLECTD_INTERVAL:-10} | |
HOSTNAME=`</etc/rightscale.d/booted` | |
while sleep $INTERVAL; do | |
squidclient -p 80 cache_object://localhost/counters | awk -v interval=${INTERVAL} -v host=${HOSTNAME} -F ' = ' '/client_http..*/ { gsub("\\.", "_", $1); print "PUTVAL", host"/squid/counter-"$1, "interval="interval, "N:"$2 }' | |
done | |
EOF | |
chmod a+x /var/lib/releng/monitoring/squid | |
/etc/init.d/collectd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment