A few years ago I had put a script on ganglia's bugzilla that modifies
the rrd files to do a few simple things, like change the heartbeat value
and change the number of RRAs, see:

http://bugzilla.ganglia.info/cgi-bin/bugzilla/show_bug.cgi?id=33

Since we are in the process of moving our gmetad server from an old
32-bit server to a new 64-bit server, I also needed the ability to move
the rrd files, which meant dumping and restoring them, so I added this
feature to the old script that I had from before.  It is attached to
this email in case anyone else might find it useful.

~Jason


On Wed, 2008-05-21 at 08:10 -0700, Witham, Timothy D wrote:
> >There may be a workaround thought: if you use 'rrdtool dump', you will
> >get a (large) XML file with all of the data.  You should be able to
> >then use 'rrdtool restore' to read this back into the new .rrd file.
> 
> But since you probably have hundreds or thousands of rrd files, you need
> some automation.  So use a script like the below saved as dumprestore.
> Run "dumprestore dump | /bin/sh" from your rrd_rootdir on the old
> system.  This will write a .xml for each .rrd.  Then rsync all the .xml
> files to new machine and run "dumprestore restore | /bin/sh".  After you
> confirm it is working you can find . -name '*.xml' -exec rm -f {} \; to
> clean up.
> 
> -twitham
> 
> #!/usr/bin/perl
> 
> use warnings;
> 
> sub oops {
>     die "$0 dump|restore\n";
> }
> my $what = shift @ARGV or &oops;
> my $in = 0;
> $in = 'rrd' if $what eq 'dump';
> $in = 'xml' if $what eq 'restore';
> &oops unless $in;
> 
> open PIPE, "find . -name '*.$in' -print |" or die $!;
> while (<PIPE>) {
>     chomp;
>     my $in = $_;
>     my $out = $in;
>     $out =~ s/\.rrd$/\.xml/ or $out =~ s/\.xml$/\.rrd/;
>     print "rrdtool $what $in ", $out =~ /xml$/ ? '> ' : '', "$out\n";
>     print "touch -r $in $out\n";
> }
> 
> 
> 
> -------------------------------------------------------------------------
> 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
> 
-- 
/------------------------------------------------------------------\
|  Jason A. Smith                          Email:  [EMAIL PROTECTED] |
|  Atlas Computing Facility, Bldg. 510M    Phone: +1-631-344-4226  |
|  Brookhaven National Lab, P.O. Box 5000  Fax:   +1-631-344-7616  |
|  Upton, NY 11973-5000,  U.S.A.                                   |
\------------------------------------------------------------------/

Attachment: ganglia-rrd-modify.pl
Description: Perl program

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

Reply via email to