merge-rrd.py not working anymore

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
esathler
Posts: 21
Joined: Wed Feb 04, 2009 2:31 pm

merge-rrd.py not working anymore

Post by esathler »

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.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

This should go to rrdtool-users mailinglist instead.
R.
Redrocket
Posts: 2
Joined: Mon Mar 07, 2011 6:09 am

Re: merge-rrd.py not working anymore

Post by Redrocket »

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,
Redrocket
Posts: 2
Joined: Mon Mar 07, 2011 6:09 am

Re: merge-rrd.py not working anymore

Post by Redrocket »

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
danial
Posts: 5
Joined: Mon Mar 14, 2011 10:36 am

Re: merge-rrd.py not working anymore

Post by danial »

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):

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]
Uxorious
Posts: 3
Joined: Sun Sep 18, 2011 9:39 pm

Re: merge-rrd.py not working anymore

Post by Uxorious »

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):
That doesn't help much.
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.
Uxorious
Posts: 3
Joined: Sun Sep 18, 2011 9:39 pm

Re: merge-rrd.py not working anymore

Post by Uxorious »

Uxorious wrote:Looks like we have to do some regex-fu to fix it.
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!

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]
Uxorious
Posts: 3
Joined: Sun Sep 18, 2011 9:39 pm

Re: merge-rrd.py not working anymore

Post by Uxorious »

Uxorious wrote:
Uxorious wrote:Looks like we have to do some regex-fu to fix it.
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!
The fix seems to be working.
antokapo
Posts: 48
Joined: Fri Nov 20, 2015 4:06 am

Re: merge-rrd.py not working anymore

Post by antokapo »

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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest