3 rrdpython - About the RRD Python bindings
8 rrdtool.create('/tmp/test.rrd', 'DS:foo:GAUGE:20:0:U')
12 The B<rrdtool> functions are directly callable via the Python programming
13 language. This wrapper implementation has been written from the scratch
16 The API's expects strings and/or list of strings as parameters to the functions.
17 Please refer to the other B<rrdtool> documentation for functions and valid arguments.
24 sys.path.append('/path/to/rrdtool/lib/python2.6/site-packages/')
25 import rrdtool, tempfile
29 fd,path = tempfile.mkstemp('.png')
35 '--start', "-%i" % YEAR,
37 '--vertical-label', 'Downloads/Day',
38 '--title', 'Annual downloads',
40 'DEF:downloads=downloads.rrd:downloads:AVERAGE',
41 'AREA:downloads#990033:Downloads')
43 info = rrdtool.info('downloads.rrd')
44 print info['last_update']
45 print info['ds[downloads].minimal_heartbeat']
50 sys.path.append('/path/to/rrdtool/lib/python2.6/site-packages/')
53 # in real life data_sources would be populated in loop or something similar
54 data_sources=[ 'DS:speed1:COUNTER:600:U:U',
55 'DS:speed2:COUNTER:600:U:U',
56 'DS:speed3:COUNTER:600:U:U' ]
58 rrdtool.create( 'speed.rrd',
59 '--start', '920804400',
61 'RRA:AVERAGE:0.5:1:24',
62 'RRA:AVERAGE:0.5:6:10' )
64 If you use the B<site-python-install> make target you can drop to first sys.path.append
65 line since the RRDtool module will be available everywhere.
67 If RRDtool runs into trouble, it will throw an exception which you might want to catch.
71 rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast,
76 Hye-Shik Chang E<lt>perky@i18n.orgE<gt>
78 Alan Milligan E<lt>alan.milligan@last-bastion.netE<gt>