Created
March 17, 2013 05:27
-
-
Save stwalkerster/5180267 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/php | |
<?php | |
$defs = "DEF:open=acc.rrd:open:AVERAGE DEF:admin=acc.rrd:admin:AVERAGE DEF:cu=acc.rrd:checkuser:AVERAGE DEF:hold=acc.rrd:hold:AVERAGE"; | |
$times = array( | |
"day" => array( | |
"date" => "-1day", | |
"title" => "day", | |
), | |
"2day" => array( | |
"date" => "-2day", | |
"title" => "2 days", | |
), | |
"4day" => array( | |
"date" => "-4day", | |
"title" => "4 days", | |
), | |
"week" => array( | |
"date" => "-1week", | |
"title" => "week", | |
), | |
"month" => array( | |
"date" => "-1month", | |
"title" => "month", | |
), | |
"year" => array( | |
"date" => "-1year", | |
"title" => "year", | |
), | |
); | |
$graphs = array( | |
"acc" => '"LINE2:open#FF0000:Open requests" "LINE2:admin#FF8800:Flagged user requests" "LINE2:cu#00FF00:Checkuser requests" "LINE2:hold#0000FF:Held requests"', | |
"acc-stack" => '"AREA:open#FF0000:Open requests:STACK" "AREA:admin#FF8800:Flagged user requests:STACK" "AREA:cu#00FF00:Checkuser requests:STACK" "AREA:hold#0000FF:Held requests:STACK"', | |
); | |
foreach( $times as $slug => $tdata ) { | |
$date = $tdata["date"]; | |
$title = $tdata["title"]; | |
foreach( $graphs as $graph => $lines ) { | |
exec( "rrdtool graph $slug/$graph.png -w 800 -h 300 -s `date -d $date +%s` -e `date +%s` --title 'ACC requests (last $title)' $defs $lines" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment