Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ACC stats graph
#!/bin/bash
STEP=300
HB=600
rrdtool create acc.rrd --start `date +%s` --step $STEP DS:open:GAUGE:$HB:0:U DS:admin:GAUGE:$HB:0:U DS:checkuser:GAUGE:$HB:0:U DS:hold:GAUGE:$HB:0:U RRA:AVERAGE:0.5:1:288 #RRA:AVERAGE:0.5:12:24 RRA:AVERAGE:0.5:288:31
#!/bin/bash
cd /home/stwalkerster/rrd/acc/
rrdtool graph acc.png -w 800 -h 300 -s `date -d -1day +%s` -e `date +%s` --title "ACC requests" DEF:open=acc.rrd:open:AVERAGE DEF:admin=acc.rrd:admin:AVERAGE DEF:cu=acc.rrd:checkuser:AVERAGE DEF:hold=acc.rrd:hold:AVERAGE "LINE3:open#FF0000:Open requests" "LINE3:admin#FF8800:Flagged user requests" "LINE3:cu#00FF00:Checkuser requests" "LINE3:hold#0000FF:Held requests"
#!/bin/bash
cd /home/stwalkerster/rrd/acc/
wget --no-check-certificate -O status.xml -o /dev/null https://toolserver.org/~acc/api.php?action=status
cat status.xml | sed "s/</\r\n</g" | grep status | sed "s/ /\n/g" | sed "s/\"\/>/\"/" | grep -v "<status" | head -n4 |sed "s/\"//g" > values
rm status.xml
chmod a+x values
. values
rm values
rrdval="N:"
rrdval=$rrdval$open
rrdval=$rrdval":"
rrdval=$rrdval$admin
rrdval=$rrdval":"
rrdval=$rrdval$checkuser
rrdval=$rrdval":"
rrdval=$rrdval$hold
#echo $rrdval;
rrdtool update /home/stwalkerster/rrd/acc/acc.rrd $rrdval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment