d504deb47bef903264abaf269abc24d18463fa1a
[rrdtool.git] / doc / rrdpython.pod
1 =head1 NAME
2
3 rrdpython - About the RRD Python bindings
4
5 =head1 SYNOPSIS
6
7  import rrdtool
8  rrdtool.create('/tmp/test.rrd', 'DS:foo:GUAGE:20:0:U')
9
10 =head1 DESCRIPTION
11
12 The B<rrdtool> functions are directly callable via the Python programming
13 language. This wrapper implementation has been written from the scratch
14 (without  SWIG)
15
16 The API's simply expects string parameters to the functions.  Please refer
17 to the other B<rrdtool> documentation for functions and valid arguments.
18
19 =head1 EXAMPLE
20
21  import sys
22  sys.path.append('/path/to/rrdtool/lib/python2.3/site-packages/')
23  import rrdtool, tempfile
24
25  DAY = 86400
26  YEAR = 365 * DAY
27  fd,path = tempfile.mkstemp('.png')
28
29  rrdtool.graph(path,
30               '--imgformat', 'PNG',
31               '--width', '540',
32               '--height', '100',
33               '--start', "-%i" % YEAR,
34               '--end', "-1",
35               '--vertical-label', 'Downloads/Day',
36               '--title', 'Annual downloads',
37               '--lower-limit', '0',
38               'DEF:downloads=downloads.rrd:downloads:AVERAGE',
39               'AREA:downloads#990033:Downloads')
40
41  info = rrdtool.info('downloads.rrd')
42  print info['last_update']
43  print info['ds']['downloads']['minimal_heartbeat']
44
45 If you use the B<site-python-install> make target you can drop to first sys.path.append
46 line since the rrdtool module will be available everywhere.
47
48 If rrdtool runs into trouble, it will throw an exception which you might want to catch.
49
50 =head1 SEE ALSO
51
52 rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast,
53 rrdxport, rrdinfo
54
55 =head1 AUTHOR
56
57 Hye-Shik Chang E<lt>perky@i18n.orgE<gt>
58
59 Alan Milligan E<lt>alan.milligan@last-bastion.netE<gt>
60