From: Florian Forster Date: Thu, 5 Jul 2012 13:48:29 +0000 (+0200) Subject: contrib/migrate-4-5.px: Break up "df" RRD files into multiple files. X-Git-Tag: collectd-5.0.5~16 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=605dab534eb2f0ee26446c157c9fdd2ad6e9427a;p=collectd.git contrib/migrate-4-5.px: Break up "df" RRD files into multiple files. --- diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px index d3ff796d..c39b51b6 100755 --- a/contrib/migrate-4-5.px +++ b/contrib/migrate-4-5.px @@ -33,6 +33,7 @@ use File::Basename ('dirname'); our $InDir = '/var/lib/collectd'; our $RRDtool = 'rrdtool'; +our $RRDFilter = 'rrd_filter.px'; our %TypesCounterToDerive = # {{{ ( @@ -184,7 +185,15 @@ sub handle_file # {{{ { my $dir = join ('/', @path); print "mkdir -p \"$dir/$plugin-$type_inst\"\n"; - print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n"; + if (($plugin eq 'df') and ($type eq 'df')) + { + print "$RRDFilter --infile=\"$path\" --outfile=\"$dir/$plugin-$type_inst/df_complex-free.rrd --map free:value\n"; + print "$RRDFilter --infile=\"$path\" --outfile=\"$dir/$plugin-$type_inst/df_complex-used.rrd --map used:value\n"; + } + else + { + print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n"; + } } } # }}} sub handle_file @@ -223,10 +232,12 @@ migrate-4-5.px [OPTIONS] Valid options are: - --indir Source directory - Default: $InDir - --rrdtool Path to the RRDtool binary - Default: $RRDtool + --indir Source directory + Default: $InDir + --rrdtool Path to the RRDtool binary + Default: $RRDtool + --rrdfilter Path to the rrd_filter.px script + Default: $RRDFilter EOF exit (1); @@ -234,8 +245,11 @@ EOF GetOptions ("indir|i=s" => \$InDir, "rrdtool=s" => \$RRDtool, + "rrdfilter=s" => \$RRDFilter, "help|h" => \&exit_usage) or exit_usage (); +print "#!/bin/bash\n\n"; + scan_dir ($InDir); # vim: set sw=2 sts=2 et fdm=marker :