merge-rrd.py not working anymore
Moderators: Developers, Moderators
merge-rrd.py not working anymore
Hi Fellas,
Sorry for the off-topic post ... but this is in the general interest... I think.
The script to merge the rrd, merge-rrd.py, that has worked well in the past, is not working anymore, not sure if is because of python or rrdtool upgrade I did... the error I get is below ... I wonder if some of you have encountered the problem and have some clue to help. Thanks in advance.
After running the command I get this:
merging old:./we_juniper_m10i_traffic_in_1463.rrd to new:./we_-_juniper_m10i_traffic_in_3639.rrd. creating merged rrd: ./we_-_juniper_m10i_traffic_in_3639.2
Traceback (most recent call last):
File "/usr/local/bin/merge-rrd.py", line 149, in <module>
mergeRRD(old_path, new_path, mer_path)
File "/usr/local/bin/merge-rrd.py", line 77, in mergeRRD
odict = getXmlDict(oxml)
File "/usr/local/bin/merge-rrd.py", line 52, in getXmlDict
cf = line.split()[1]
IndexError: list index out of range
I am now running rrdtool 1.4.3 on FreeBSD 7.1. I have tried the script with python 2.4 and 2.5, the same error comes out.
Sorry for the off-topic post ... but this is in the general interest... I think.
The script to merge the rrd, merge-rrd.py, that has worked well in the past, is not working anymore, not sure if is because of python or rrdtool upgrade I did... the error I get is below ... I wonder if some of you have encountered the problem and have some clue to help. Thanks in advance.
After running the command I get this:
merging old:./we_juniper_m10i_traffic_in_1463.rrd to new:./we_-_juniper_m10i_traffic_in_3639.rrd. creating merged rrd: ./we_-_juniper_m10i_traffic_in_3639.2
Traceback (most recent call last):
File "/usr/local/bin/merge-rrd.py", line 149, in <module>
mergeRRD(old_path, new_path, mer_path)
File "/usr/local/bin/merge-rrd.py", line 77, in mergeRRD
odict = getXmlDict(oxml)
File "/usr/local/bin/merge-rrd.py", line 52, in getXmlDict
cf = line.split()[1]
IndexError: list index out of range
I am now running rrdtool 1.4.3 on FreeBSD 7.1. I have tried the script with python 2.4 and 2.5, the same error comes out.
Re: merge-rrd.py not working anymore
Seeing as this is a high enough result when I search, and no result in rrdtool mailing lists, ill post the info here, it's as good as any for reference?
It's not just merge-rrd.py that doesnt work, there are many different tools out there, none of which I got to work, yet.
http://www.pintori.it/rrd-merger/ RRD Merger v0.2 1 may 2005, Perl
http://oss.oetiker.ch/rrdtool/pub/contrib/merge-rrd.tgz 11-April-2005, Python,
http://www.lemski.pl/doku.php/progs:merge-rrd.pl # 2008 - 2009 --lemski Perl
http://code.google.com/p/merge-rrds/ merge-rrds.py Version 0.0.1. Oct 01 2010 Python,
It's not just merge-rrd.py that doesnt work, there are many different tools out there, none of which I got to work, yet.
http://www.pintori.it/rrd-merger/ RRD Merger v0.2 1 may 2005, Perl
http://oss.oetiker.ch/rrdtool/pub/contrib/merge-rrd.tgz 11-April-2005, Python,
http://www.lemski.pl/doku.php/progs:merge-rrd.pl # 2008 - 2009 --lemski Perl
http://code.google.com/p/merge-rrds/ merge-rrds.py Version 0.0.1. Oct 01 2010 Python,
Re: merge-rrd.py not working anymore
And *something* works, I downgraded from rrdtool-1.4.4. to rrdtool-1.3.9-1 from centos epel, the script I used was http://www.lemski.pl/doku.php/progs:merge-rrd.pl
Re: merge-rrd.py not working anymore
The rrdtool format has most likely changed since the merged-rrd.py script was written.
Make the following changes to the script (the lower line is the modified one):
Make the following changes to the script (the lower line is the modified one):
Code: Select all
52c52
< cf = line.split()[1]
---
> cf = line.split()[0]
55c55
< pdp = line.split()[1]
---
> pdp = line.split()[0]
60c60
< val = ele[8]
---
> val = ele[7]
90c90
< cf = line.split()[1]
---
> cf = line.split()[0]
93c93
< pdp = line.split()[1]
---
> pdp = line.split()[0]
98c98
< val = ele[8]
---
> val = ele[7]
Re: merge-rrd.py not working anymore
That doesn't help much.danial wrote:The rrdtool format has most likely changed since the merged-rrd.py script was written.
Make the following changes to the script (the lower line is the modified one):
The old merge script relies SPACES being inserted between the XML tags and the values ... and they are now gone.
Looks like we have to do some regex-fu to fix it.
Re: merge-rrd.py not working anymore
I don't have any of the old-style RRD files here, and I can't easily test that this works as intended - but at least it creates the output file!Uxorious wrote:Looks like we have to do some regex-fu to fix it.
Make the following changes to the script (the lower lines are the modified ones ... or apply it with "patch"):
Code: Select all
12,13c12,13
< reMatchCF = re.compile(".*<cf>").match
< reMatchPDP = re.compile(".*<pdp_per_row>").match
---
> reMatchCF = re.compile(".*<cf>(.*)</cf>").match
> reMatchPDP = re.compile(".*<pdp_per_row>(.*)</pdp_per_row>").match
16c16
< reMatchRow = re.compile(".*<row><v>").match
---
> reMatchRow = re.compile(".*<row><v>(.*?)</v>").match
52c52
< cf = line.split()[1]
---
> cf = reMatchCF(line).groups()[0]
55c55
< pdp = line.split()[1]
---
> pdp = reMatchPDP(line).groups()[0]
60c60
< val = ele[8]
---
> val = reMatchRow(line).groups()[0]
90c90
< cf = line.split()[1]
---
> cf = reMatchCF(line).groups()[0]
93c93
< pdp = line.split()[1]
---
> pdp = reMatchPDP(line).groups()[0]
98c98
< val = ele[8]
---
> val = reMatchRow(line).groups()[0]
Re: merge-rrd.py not working anymore
The fix seems to be working.Uxorious wrote:I don't have any of the old-style RRD files here, and I can't easily test that this works as intended - but at least it creates the output file!Uxorious wrote:Looks like we have to do some regex-fu to fix it.
Re: merge-rrd.py not working anymore
Hi
I can confirm you that the python script works with the suggested changes, i merged old rrd files with new ones after a moving of them to a new file system.
Antonello
I can confirm you that the python script works with the suggested changes, i merged old rrd files with new ones after a moving of them to a new file system.
Antonello
Who is online
Users browsing this forum: No registered users and 1 guest