Created
November 10, 2016 09:51
-
-
Save aclemmensen/9cb8d11da0d7f07f663ebe5c71f4ec29 to your computer and use it in GitHub Desktop.
Put squid stats into Statsd
This file contains 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
#!/bin/bash | |
i=0 | |
while true; do | |
echo "Sending batch $i" | |
i=$(($i+1)) | |
/opt/si-squid/bin/squidclient cache_object://localhost/counters \ | |
| awk ' | |
BEGIN { p=0 } | |
/^sample_time/ { p=1 } | |
{ | |
if(p > 1) printf("sistats.squid.%s:%d|g\n", $1, $3) | |
if(p > 0) p = p+1 | |
}' \ | |
| nc -C -u -w1 127.0.0.1 8125 | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment