Hello,
I'm trying to add a new RRA to an RRD file. I need to preserve my old
data.
I found a post in the list archive that suggested I do a dump, and
modify the RRD and then restore the old data into the new RRD. So this
is what I tried to do.
I created a new RRD with the default RRAs, plus a new one.
rrdtool create cpu_pool_idle_new.rrd --step 15 \
DS:sum:GAUGE:120:U:U \
RRA:AVERAGE:0.5:1:244 \
RRA:AVERAGE:0.5:24:244 \
RRA:AVERAGE:0.5:168:244 \
RRA:AVERAGE:0.5:672:244 \
RRA:AVERAGE:0.5:5760:374 \
RRA:MIN:0.5:60:2980 # <---------- NEW RRA
I then dumped the new rrd and copied the new RRA section into a file,
called append.xml.
Then I wrote a perl script to insert the new RRA into the xml dump of my
existing RRD. I then restored the modified xml file into a new RRD.
I saved off the old rrd, and replaced it with the new RRD, hoping that
gmetad will continue to update the new RRD without missing a beat.
That did not happen. The new RRD doesn't receive any new updates, or
gmetad doesn't send it updates any more.
I restarted gmetad but that didn't help.
Can someone tell me what I'm doing wrong here? Do you have a better
suggestion?
Thanks.
#!/usr/bin/perl
# $oldxmlfile="cpu_pool_idle.xml";
# $oldrrdfile="cpu_pool_idle.rrd";
# $newrrdfile="cpu_pool_idle_new.rrd";
# $newxmlfile="cpu_pool_idle_new.xml";
$oldxmlfile="pkts_in.xml";
$oldrrdfile="pkts_in.rrd";
$newrrdfile="pkts_in_new.rrd";
$newxmlfile="pkts_in_new.xml";
$appendxmlfile="append.xml";
system("rrdtool dump $oldrrdfile > $oldxmlfile");
open OLDXML, ("< $oldxmlfile");
open NEWXML, ("> $newxmlfile");
open APPENDXML, ("< $appendxmlfile");
my(@oldxml) = <OLDXML>; # read file into list
my(@appxml) = <APPENDXML>;
for (@oldxml) {
if (! /<\/rrd\>/) {
print NEWXML $_;
} else {
for $appline (@appxml) {
print NEWXML $appline;
}
print NEWXML $_;
last;
}
}
close (OLDXML);
close (NEWXML);
close (APPLENDXML);
system("rrdtool restore $newxmlfile $newrrdfile");
system("cp -p $oldrrdfile $oldrrdfile.org");
system("cp -p $newrrdfile $oldrrdfile");
David Wong
Senior Systems Engineer
Management Dynamics, Inc.
Phone: 201-804-6127
[EMAIL PROTECTED]
The information contained in this e-mail message, including any
attachments, constitutes proprietary and confidential information of
Management Dynamics, Inc. and is intended only for the personal and
confidential use of the recipient or recipients named above. If the
reader of this message is not the intended recipient, you are hereby
notified that you have received this message in error and that any
review, dissemination, distribution, or copying of this message is
strictly prohibited. If you have received this communication in error,
please notify the sender immediately by e-mail and delete the original
message.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general