test script to generate some output
authorTero Marttila <terom@fixme.fi>
Sun, 06 Dec 2009 01:18:49 +0200
changeset 2 a6bbe5cc24d7
parent 1 18787b57ba46
child 3 2fefcb99df6e
test script to generate some output
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",
+)