Skip to content

Instantly share code, notes, and snippets.

@jbuchbinder
Created June 6, 2012 21:35
Show Gist options
  • Save jbuchbinder/2884969 to your computer and use it in GitHub Desktop.
Save jbuchbinder/2884969 to your computer and use it in GitHub Desktop.
Poll rrdcache stats from control socket for Ganglia
#!/bin/bash
#
# rrdcache-stats.sh
# @jbuchbinder
#
GMETRIC="/usr/bin/gmetric"
( echo "STATS"; sleep 1; echo "QUIT" ) | \
sudo socat - unix:/var/rrdtool/rrdcached/rrdcached.sock | \
grep ':' | \
while read X; do
K="$( echo "$X" | cut -d: -f1 )"
V="$( echo "$X" | cut -d: -f2 )"
$GMETRIC -g rrdcached -t uint32 -n "rrdcached_stat_${K}" -v ${V} -x 300 -d 300
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment