From: Sebastian Harl Date: Fri, 4 Apr 2008 20:05:48 +0000 (+0200) Subject: migrate-3-4.px: Use 'rrdtool tune' instead of 'sed' to rename DS's. X-Git-Tag: collectd-4.4.0~44 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68cf1d4cbc778efaafc30127bff607114a92a825;p=collectd.git migrate-3-4.px: Use 'rrdtool tune' instead of 'sed' to rename DS's. Either the output format of 'rrdtool dump' has changed or there was an error in the regex used with sed in the first place. Anyway, in some cases the 'if_octects' DS's did not get translated. 'rrdtool tune' should be able to handle it correctly in any case. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/contrib/migrate-3-4.px b/contrib/migrate-3-4.px index 673929cc..bb5bc94c 100755 --- a/contrib/migrate-3-4.px +++ b/contrib/migrate-3-4.px @@ -169,22 +169,23 @@ for (@Files) print "./rrd_filter.px -i '$InDir/$orig_filename' -m '${src_ds}:${dst_ds}' -o '$OutDir/$dest_filename'\n"; } } - elsif (exists ($TypeRename{$orig->{'type'}})) + else + { + print "cp '$InDir/$orig_filename' '$OutDir/$dest_filename'\n"; + } + + if (exists ($TypeRename{$orig->{'type'}})) { my $src_dses = $TypeRename{$orig->{'type'}}->{'from'}; my $dst_dses = $TypeRename{$orig->{'type'}}->{'to'}; - my @sed_prog = (); + print "rrdtool tune '$OutDir/$dest_filename'"; for (my $i = 0; $i < @$src_dses; $i++) { - push (@sed_prog, 's/^' . $src_dses->[$i] . '$/' . $dst_dses->[$i] . '/g;'); + print " --data-source-rename " + . $src_dses->[$i] . ':' . $dst_dses->[$i]; } - - print "rrdtool dump '$InDir/$orig_filename' | sed -e '" . join (' ', @sed_prog) . "' | rrdtool restore - '$OutDir/$dest_filename'\n"; - } - else - { - print "cp '$InDir/$orig_filename' '$OutDir/$dest_filename'\n"; + print "\n"; } }