# HG changeset patch # User Tero Marttila # Date 1260055129 -7200 # Node ID a6bbe5cc24d7c25a697e32c217a17f9bef1eb484 # Parent 18787b57ba460df72085130861a969e5c31c2530 test script to generate some output diff -r 18787b57ba46 -r a6bbe5cc24d7 test.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test.py Sun Dec 06 01:18:49 2009 +0200 @@ -0,0 +1,77 @@ +from rrdweb import rrd + +rrd_path = "rrd/armo.switches.pvl_atk-luokka.rrd" +out_path = "img/armo.switches.pvl_atk-luokka.png" + +detail_size = (600, 200) + + +rrd.graph(out_path, + # data sources, bytes/s + r'DEF:in0=%s:ds0:AVERAGE' % rrd_path, + r'DEF:out0=%s:ds1:AVERAGE' % rrd_path, + + # data, bits/s + 'CDEF:in=in0,8,*', + 'CDEF:out=out0,8,*', + + # values + 'VDEF:in_max=in,MAXIMUM', + 'VDEF:in_avg=in,AVERAGE', + 'VDEF:in_min=in,MINIMUM', + 'VDEF:out_max=out,MAXIMUM', + 'VDEF:out_avg=out,AVERAGE', + 'VDEF:out_min=out,MINIMUM', + + # legend/graph + "COMMENT:%4s" % "", + "COMMENT:%11s" % "Maximum", + "COMMENT:%11s" % "Average", + "COMMENT:%11s\\l" % "Minimum", + + "LINE1:in#0000FF:%4s" % "In", + 'GPRINT:in_max:%6.2lf %Sbps', + 'GPRINT:in_avg:%6.2lf %Sbps', + 'GPRINT:in_min:%6.2lf %Sbps\\l', + + "LINE1:out#00CC00:%4s" % "Out", + 'GPRINT:out_max:%6.2lf %Sbps', + 'GPRINT:out_avg:%6.2lf %Sbps', + 'GPRINT:out_min:%6.2lf %Sbps\\l', + + # output + imgformat = "PNG", + lazy = True, + + # dimensions + width = detail_size[0], + height = detail_size[1], + + color = [ + # disable border + # border = 0, + "SHADEA#ffffff00", + "SHADEB#ffffff00", + + # keep background transparent + "BACK#ffffff00", + "SHADEB#ffffff00", + ], + + # labels + vertical_label = "bits/s", + units = "si", + x_grid = "MINUTE:15:HOUR:1:HOUR:4:0:%H:%M", + + # use logarithmic scaling + logarithmic = True, + + # smooth out lines + slope_mode = True, + + # general info + title = "Daily Traffic @ armo.switches.pvl -> atk-luokka", + + # interval + start = "-24h", +)