我有一个旧的RRD文件,它只设置为跟踪一年的历史。我觉得更多的历史会更好。我调整了rrdtool的大小,RRD现在变大了。我有这个RRD文件的旧备份,我想合并旧数据,以便最新的RRD也包含历史数据。
我尝试过rrd工具“merged rrd.py”,但它提供了:
$ python merged-rrd.py ../temperature-2010-12-06.rrd ../temperature-2011-05-24.rrd merged1.rrd
merging old:../temperature-2010-12-06.rrd to new:../temperature-2011-05-24.rrd. creating merged rrd: merged1.rrd
Traceback (most recent call last):
File "merged-rrd.py", line 149, in <module>
mergeRRD(old_path, new_path, mer_path)
File "merged-rrd.py", line 77, in mergeRRD
odict = getXmlDict(oxml)
File "merged-rrd.py", line 52, in getXmlDict
cf = line.split()[1]
IndexError: list index out of range我也尝试了"rrd_merger.pl":
$ perl rrd_merger.pl --oldrrd=../temperature-2010-12-06.rrd --newrrd=../temperature-2011-05-24.rrd --mergedrrd=merged1.rrd
Dumping ../temperature-2010-12-06.rrd to XML: /tmp/temperature-2010-12-06.rrd_old_8615.xml
Dumping ../temperature-2011-05-24.rrd to XML: /tmp/temperature-2011-05-24.rrd_new_8615.xml
Parsing ../temperature-2010-12-06.rrd XML......parsing completed
Parsing ../temperature-2011-05-24.rrd XML...
Last Update: 1306217100
Start processing Round Robin DB
Can't call method "text" on an undefined value at rrd_merger.pl line 61.
at rrd_merger.pl line 286
at rrd_merger.pl line 286有没有工具可以合并或合并RRD?
发布于 2012-03-23 10:46:25
通过检查现有的python脚本,我最终组装了一个非常简单的脚本,对我的情况来说已经足够好用了。
http://gist.github.com/2166343
发布于 2013-02-22 01:34:48
为我修复了rrdtool-merge.pl:
< my $xff = $new_rra->first_child( 'xff' )->text;
---
> my $xff = $new_rra->first_child_text( 'xff' );来自XML::Twig文档:
first_child_text ($optional_condition)
Return the text of the first child of the element, or the first child
matching the $optional_condition If there is no first_child then returns ''. This
avoids getting the child, checking for its existence then getting the text for trivial
cases.发布于 2014-09-01 06:39:15
包含在/extras目录中的Routers2中的rrdmerge.pl实用程序可以做到这一点。从http://www.steveshipway.org/software/rrd/收集最新版本的Routers2
这是我编写的一个实用程序,用于合并多个存档的MRTG RRD文件,听起来与您提到的情况完全相同。
这可能对OP来说太晚了,但希望对后来来这里的人有用。它可以合并任何RRD文件,即使具有不同的DS,RRA或间隔,并可以生成XML或RRD,并将从组件RRD文件中挑选最佳可用的数据进行输出。
示例:
rrdmerge.pl --rrd --libpath $RRDLIBDIR --output /tmp/merge.rrd --rows 12000 $FROMDIR/file.rrd $ARCHIVE/*.rrdhttps://stackoverflow.com/questions/9816139
复制相似问题