Tim’s Weblog Tim's Weblog
Tim Strehle’s links and thoughts on Web apps, managing software development and Digital Asset Management, since 2002.


I keep forgetting how to get started with the wonderful rrdtool, so here's a note to myself for the next time (and here's the tutorial)…

I'm creating a database with these characteristics:

  • a single, once every 10 minute measured gauge named "num" which is OK with up to 20 minute gaps between values
  • 10 minute resolution stored for one week
  • 1 hour resolution for one month
  • 1 day resolution for three years

rrdtool create counter.rrd --step 600 DS:num:GAUGE:1200:0:U RRA:LAST:0.5:1:1008 RRA:AVERAGE:0.5:6:744 RRA:AVERAGE:0.5:144:1095

Inserting the current value:

rrdtool update counter.rrd N:`echo 'select count(JOB_ID) from DCX_JOB where JOB_STATUS = 1;' | mysql -h localhost -P 3306 -u username -psecret dbname -s`

Creating a graph as a PNG file:

rrdtool graph counter.png DEF:val=counter.rrd:num:LAST LINE2:val#FF0000 

Wed, 15 Apr 2009 12:42:43 +0000