Last change
on this file since 1 was
1,
checked in by bastiaans, 19 years ago
|
Initial import in repository
|
File size:
1.3 KB
|
Rev | Line | |
---|
[1] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import os |
---|
| 4 | import time |
---|
| 5 | |
---|
| 6 | # Location of rrdtool |
---|
| 7 | RRDTOOL_BIN = '/usr/bin/rrdtool' |
---|
| 8 | |
---|
| 9 | # Location of Ganglia's rrd's |
---|
| 10 | GANGLIA_RRD_DIR = '/var/lib/ganglia/rrds' |
---|
| 11 | |
---|
| 12 | # Location where you want our own rrd's stored |
---|
| 13 | MYDATA_DIR = '/data/myrrds' |
---|
| 14 | |
---|
| 15 | for root, dirs, files in os.walk( GANGLIA_RRD_DIR, topdown=False ): |
---|
| 16 | |
---|
| 17 | for name in files: |
---|
| 18 | if name.find('.rrd') != -1 and root.find('__SummaryInfo__') == -1: |
---|
| 19 | |
---|
| 20 | ganglia_rrd = os.path.join( root, name ) |
---|
| 21 | rel_dir = ganglia_rrd[len(GANGLIA_RRD_DIR):] |
---|
| 22 | mydata_rrd = MYDATA_DIR + rel_dir |
---|
| 23 | |
---|
| 24 | if not os.path.isdir( MYDATA_DIR + os.path.dirname(rel_dir) ): |
---|
| 25 | #print 'mkdir ' + MYDATA_DIR + os.path.dirname(rel_dir) |
---|
| 26 | os.makedirs( MYDATA_DIR + os.path.dirname(rel_dir) ) |
---|
| 27 | |
---|
| 28 | #if os.path.exists( '/tmp/ramdisk/myblatemp.xml' ): |
---|
| 29 | # os.remove( '/tmp/ramdisk/myblatemp.xml' ) |
---|
| 30 | |
---|
| 31 | #xml = open( '/tmp/ramdisk/myblatemp.xml', 'w' ) |
---|
| 32 | |
---|
| 33 | #print RRDTOOL_BIN + ' dump "' + ganglia_rrd + '" | head -271' |
---|
| 34 | #rrd_dump = os.popen( RRDTOOL_BIN + ' dump "' + ganglia_rrd + '" | head -271', 'r') |
---|
| 35 | |
---|
| 36 | #for regel in rrd_dump.readlines(): |
---|
| 37 | # xml.write( regel ) |
---|
| 38 | |
---|
| 39 | #rrd_dump.close() |
---|
| 40 | |
---|
| 41 | #xml.write( '</rrd>' ) |
---|
| 42 | |
---|
| 43 | #xml.close() |
---|
| 44 | |
---|
| 45 | #print 'cp "' + ganglia_rrd + '" "' + mydata_rrd + '"' |
---|
| 46 | os.system( 'cp "' + ganglia_rrd + '" "' + mydata_rrd + '"' ) |
---|
Note: See
TracBrowser
for help on using the repository browser.