Skip to content

Instantly share code, notes, and snippets.

@noahcampbell
Created April 14, 2011 00:01
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save noahcampbell/918684 to your computer and use it in GitHub Desktop.
Save noahcampbell/918684 to your computer and use it in GitHub Desktop.
Collectd script for squid
# Steps for turning on squid monitoring (until I have an rpm)
cat > /etc/collectd.d/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=${COLLETD_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
@wrzasa
Copy link

wrzasa commented Jul 8, 2016

No, it is not correct. Fix the typo mentioned by @shish and it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment