110 likes | 269 Views
Introduction to RRDTool. Speaker: Yan-Shiang Wang Date:2006.6.7. Flexible. Record variety of data type Update input data to rrd file via your script Graph variety of function. Round Robin Archive. CF: consolidation function consolidation interval: heartbeat * xff (xfiles factor)
E N D
Introduction to RRDTool Speaker: Yan-Shiang Wang Date:2006.6.7
Flexible • Record • variety of data type • Update • input data to rrd file via your script • Graph • variety of function
Round Robin Archive • CF: consolidation function • consolidation interval: heartbeat * xff (xfiles factor) • steps: int * consolidation interval interval: 5mins interval:30mins interval:2hrs interval:24hrs
CREATE(1/2) rrdtool create filename[--start|-b start time][--step|-s step][DS:ds-name:DST:heartbeat:min:max][RRA:CF:xff:steps:rows] • --start: start record date in seconds (default is Now) • --step: base interval in seconds • ds-name: data source name • DST: GAUGE|COUNTER|DRIVE|ABSOLUTE
CREATE(2/2) • heartbeat: maximum number of seconds that may pass between two updates • min & max: expected range values • CF: AVERAGE|MIN|MAX|LAST • xff: define consolidation interval may be made up from *UNKNOWN* • steps: how many of these primary data points are used to build a consolidated data point • rows: how many generations of data values are kept in an RRA
CREATE - example rrdtool create test.rrd \ DS:input:COUNTER:600:U:U \ DS:output:COUNTER:600:U:U \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 \ RRA:MAX:0.5:24:775 \ RRA:MAX:0.5:288:797
UPDATE rrdtool update filename--template|-t ds-name:ds-name:...time|N:value[:value...]at-time@value[:value...][ time:value[:value...] ..]
UPDATE - example #!/usr/local/bin/bash in=`snmpget -c ncnu -v 2c localhost IF-MIB::ifInOctets.1 | cut -c 35-` out=`snmpget -c ncnu -v 2c localhost IF-MIB::ifOutOctets.1 | cut -c 36-` rrdtool update test.rrd N:$in:$out
GRAPH rrdtool graph filename[-s|--start seconds] [-e|--end seconds][DEF:vname=rrd:ds-name:CF][LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]][-w|--width pixels] [-h|--height pixels] [-t|--title string][GPRINT:vdefname:format][CDEF:vname=rpn-expression][COMMENT:text]
GRAPH – example now=`date "+%Y/%m/%d %H\:%M\:%S"` rrdtool graph test.png \ DEF:inoctets=test.rrd:input:AVERAGE \ DEF:outoctets=test.rrd:output:AVERAGE \ COMMENT:" Max Average Min Now\n" \ LINE1:inoctets#00FF00:" In traffic" \ GPRINT:inoctets:MAX:"%9.0lf" \ GPRINT:inoctets:AVERAGE:"%9.0lf" \ GPRINT:inoctets:MIN:"%9.0lf" \ GPRINT:inoctets:LAST:"%9.0lf\n" \ LINE1:outoctets#0000FF:"Out traffic" \ GPRINT:outoctets:MAX:"%9.0lf" \ GPRINT:outoctets:AVERAGE:"%9.0lf" \ GPRINT:outoctets:MIN:"%9.0lf" \ GPRINT:outoctets:LAST:"%9.0lf\n" \ --title "Traffic" -v "Bytes per second" COMMENT:"\n" \ COMMENT:"Last Updated\: $now" -s -1d -w 600 -h 150
Reference • RRDTool.org • http://oss.oetiker.ch/rrdtool/ • Documents • http://www.study-area.org/tips/rrdtool/rrdtool.html • http://phorum.study-area.org/viewtopic.php?t=18496