summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0eff156)
raw | patch | inline | side by side (parent: 0eff156)
author | Florian Forster <octo@noris.net> | |
Wed, 5 Jan 2011 09:15:32 +0000 (10:15 +0100) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 5 Jan 2011 09:15:32 +0000 (10:15 +0100) |
contrib/migrate-4-5.px | patch | blob | history |
diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px
index efb2e0a136e34f35ee50edd1cc1870e6905d42ab..1e54683ae0333848b26dbd9269678a0387de0590 100755 (executable)
--- a/contrib/migrate-4-5.px
+++ b/contrib/migrate-4-5.px
our $InDir = '/var/lib/collectd';
our $OutDir = '/tmp/collectd-5';
-our $Hostname = 'localhost';
+our $RRDtool = 'rrdtool';
our %TypesCounterToDerive = # {{{
(
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})
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";
}
}
closedir ($dh);
} # }}} sub scan_dir
+sub exit_usage # {{{
+{
+ print STDERR <<EOF;
+migrate-4-5.px [OPTIONS]
+
+Valid options are:
+
+ --indir <dir> Source directory
+ Default: $InDir
+ --outdir <dir> Destination directory
+ Default: $OutDir
+ --rrdtool <path> Path to the RRDtool binary
+ Default: $RRDtool
+
+EOF
+ exit (1);
+} # }}} sub exit_usage
+
+GetOptions ("indir|i=s" => \$InDir,
+ "outdir|o=s" => \$OutDir,
+ "rrdtool=s" => \$RRDtool,
+ "help|h" => \&exit_usage) or exit_usage ();
+
scan_dir ($InDir);
# vim: set sw=2 sts=2 et fdm=marker :