X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fmigrate-4-5.px;h=539eaa332fe217def1bf5a0ce91791509fb9b1e8;hb=e61872d4b1325cb8d54f4cdb16f185fcfe2710a7;hp=efb2e0a136e34f35ee50edd1cc1870e6905d42ab;hpb=74761a89659630c5f7d1d849ae7d28ae1605d9be;p=collectd.git diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px index efb2e0a1..539eaa33 100755 --- a/contrib/migrate-4-5.px +++ b/contrib/migrate-4-5.px @@ -32,8 +32,7 @@ use Data::Dumper (); use File::Basename ('dirname'); our $InDir = '/var/lib/collectd'; -our $OutDir = '/tmp/collectd-5'; -our $Hostname = 'localhost'; +our $RRDtool = 'rrdtool'; our %TypesCounterToDerive = # {{{ ( @@ -46,7 +45,6 @@ our %TypesCounterToDerive = # {{{ connections => ["value"], cpu => ["value"], current => ["value"], - df => ["used", "free"], disk_merged => ["read", "write"], disk_octets => ["read", "write"], disk_ops => ["read", "write"], @@ -167,7 +165,7 @@ sub handle_file # {{{ if ($TypesRenameDataSource{$type}) { my $old_ds = $TypesRenameDataSource{$type}; - print "rrdtool tune \"$path\" --data-source-rename ${old_ds}:value\n"; + print "$RRDtool tune \"$path\" --data-source-rename ${old_ds}:value\n"; } if ($TypesCounterToDerive{$type}) @@ -177,7 +175,7 @@ sub handle_file # {{{ for (@$ds_names) { my $name = $_; - print "rrdtool tune \"$path\" --data-source-type ${name}:DERIVE --minimum ${name}:0 --maximum ${name}:U\n"; + print "$RRDtool tune \"$path\" --data-source-type ${name}:DERIVE --minimum ${name}:0 --maximum ${name}:U\n"; } } @@ -217,6 +215,26 @@ sub scan_dir # {{{ closedir ($dh); } # }}} sub scan_dir +sub exit_usage # {{{ +{ + print STDERR < Source directory + Default: $InDir + --rrdtool Path to the RRDtool binary + Default: $RRDtool + +EOF + exit (1); +} # }}} sub exit_usage + +GetOptions ("indir|i=s" => \$InDir, + "rrdtool=s" => \$RRDtool, + "help|h" => \&exit_usage) or exit_usage (); + scan_dir ($InDir); # vim: set sw=2 sts=2 et fdm=marker :