|
| File t.py,
685 bytes
(added by human, 4 years ago) |
|
Run it with "python t.py"
|
| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | |
|---|
| 3 | import rrdtool, os, sys |
|---|
| 4 | |
|---|
| 5 | #create db |
|---|
| 6 | rrdtool.create('test.rrd', '-s', '60', 'DS:in:GAUGE:120:U:125000000', |
|---|
| 7 | 'DS:out:GAUGE:120:U:125000000', 'RRA:AVERAGE:0.5:1:129600', |
|---|
| 8 | 'RRA:AVERAGE:0.5:12:105120') |
|---|
| 9 | |
|---|
| 10 | # and final demonstration |
|---|
| 11 | for interval in [3600*24,3600*24*7,3600*24*31,3600*24*365]: |
|---|
| 12 | print interval |
|---|
| 13 | rrdtool.graph('test.png', '-w', '576', '--zoom', '5', '--start', '-%s' % interval, |
|---|
| 14 | '--lazy', |
|---|
| 15 | 'DEF:in=test.rrd:in:AVERAGE', |
|---|
| 16 | 'AREA:in#ff0000', |
|---|
| 17 | 'LINE1:in#000000', |
|---|
| 18 | 'COMMENT:X=3\l', |
|---|
| 19 | 'COMMENT:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \r', |
|---|
| 20 | 'COMMENT:Generated at Sun Dec 30 16.54.51 2007 by SAGATOR \r' |
|---|
| 21 | ) |
|---|
Download in other formats:
|