|
RRDtool
rrdpythonSYNOPSIS
import rrdtool
rrdtool.create('/tmp/test.rrd', 'DS:foo:GAUGE:20:0:U')
DESCRIPTIONThe rrdtool functions are directly callable via the Python programming language. This wrapper implementation has been written from the scratch (without SWIG) The API's simply expects string parameters to the functions. Please refer to the other rrdtool documentation for functions and valid arguments. EXAMPLE
import sys
sys.path.append('/path/to/rrdtool/lib/python2.3/site-packages/')
import rrdtool, tempfile
DAY = 86400
YEAR = 365 * DAY
fd,path = tempfile.mkstemp('.png')
rrdtool.graph(path,
'--imgformat', 'PNG',
'--width', '540',
'--height', '100',
'--start', "-%i" % YEAR,
'--end', "-1",
'--vertical-label', 'Downloads/Day',
'--title', 'Annual downloads',
'--lower-limit', '0',
'DEF:downloads=downloads.rrd:downloads:AVERAGE',
'AREA:downloads#990033:Downloads')
info = rrdtool.info('downloads.rrd')
print info['last_update']
print info['ds']['downloads']['minimal_heartbeat']
If you use the site-python-install make target you can drop to first sys.path.append line since the rrdtool module will be available everywhere. If rrdtool runs into trouble, it will throw an exception which you might want to catch. SEE ALSOrrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport, rrdinfo AUTHORHye-Shik Chang <perky@i18n.org> Alan Milligan <alan.milligan@last-bastion.net> |
|
|
10/30/08 | Hye-Shik Chang | OETIKER+PARTNER AG
|
NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.