Created
April 14, 2011 00:01
-
-
Save noahcampbell/918684 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.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 |
I did exactly same as you provide and it doesn't work. Respectively I'm getting some incorrect data. Did you also customize types.db?
rrdtool dump counter-client_http_requests.rrd > test.xml
Couple of lines:
<!-- 2016-03-22 12:20:30 CET / 1458645630 --> <row><v>1.0000000000e-01</v></row> <!-- 2016-03-22 12:20:40 CET / 1458645640 --> <row><v>1.0000000000e-01</v></row> <!-- 2016-03-22 12:20:50 CET / 1458645650 --> <row><v>9.5454545455e-02</v></row> <!-- 2016-03-22 12:21:00 CET / 1458645660 --> <row><v>9.4545454545e-02</v></row>
Output from CLI is correct:
PUTVAL xx/squid/counter-client_http_requests interval= N:49749
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
COLLETD_INTERVAL - should be COLLECTD_INTERVAL?