Skip to content

Instantly share code, notes, and snippets.

@kashyapp
Created January 8, 2013 13:20
Show Gist options
  • Save kashyapp/4483766 to your computer and use it in GitHub Desktop.
Save kashyapp/4483766 to your computer and use it in GitHub Desktop.
Stupid script to read from sysstat and send to carbon
#!/bin/bash
set -e
#set -x
SEND="nc -v -v -q2 w3-api3 2003"
#SEND=cat
SED="sed s/[%/]//gI"
SADF="sadf -s $1 /var/log/sysstat/$2 --"
$SADF -d | grep 'dev254-[278]' | $SED | awk '{print "sys.hostmetrics." $1 ".deviceio." $4 "." $5 ".per_min", $6, $3}' | $SEND
$SADF -S | fgrep kbswp | $SED | awk '{print "sys.hostmetrics." $1 ".deviceio." $5 ".per_min", $6, $3}' | $SEND
$SADF -r | grep '\<kb' | $SED | awk '{print "sys.hostmetrics." $1 ".deviceio." $5 ".per_min", $6, $3}' | $SEND
$SADF -W | $SED | awk '{print "sys.hostmetrics." $1 ".deviceio." $5 ".per_min", $6, $3}' | $SEND
$SADF -b | $SED | awk '{print "sys.hostmetrics." $1 ".deviceio." $5 ".per_min", $6, $3}' | $SEND
$SADF -q | fgrep ldavg-5| $SED | awk '{print "sys.hostmetrics." $1 ".load." $5 ".per_min", $6, $3}' | $SEND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment