1 commit 605dab534eb2f0ee26446c157c9fdd2ad6e9427a
2 Author: Florian Forster <octo@collectd.org>
3 Date: Thu Jul 5 15:48:29 2012 +0200
5 contrib/migrate-4-5.px: Break up "df" RRD files into multiple files.
7 diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px
8 index d3ff796..c39b51b 100755
9 --- a/contrib/migrate-4-5.px
10 +++ b/contrib/migrate-4-5.px
11 @@ -33,6 +33,7 @@ use File::Basename ('dirname');
13 our $InDir = '/var/lib/collectd';
14 our $RRDtool = 'rrdtool';
15 +our $RRDFilter = 'rrd_filter.px';
17 our %TypesCounterToDerive = # {{{
18 (
19 @@ -184,7 +185,15 @@ sub handle_file # {{{
20 {
21 my $dir = join ('/', @path);
22 print "mkdir -p \"$dir/$plugin-$type_inst\"\n";
23 - print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n";
24 + if (($plugin eq 'df') and ($type eq 'df'))
25 + {
26 + print "$RRDFilter --infile=\"$path\" --outfile=\"$dir/$plugin-$type_inst/df_complex-free.rrd --map free:value\n";
27 + print "$RRDFilter --infile=\"$path\" --outfile=\"$dir/$plugin-$type_inst/df_complex-used.rrd --map used:value\n";
28 + }
29 + else
30 + {
31 + print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n";
32 + }
33 }
34 } # }}} sub handle_file
36 @@ -223,10 +232,12 @@ migrate-4-5.px [OPTIONS]
38 Valid options are:
40 - --indir <dir> Source directory
41 - Default: $InDir
42 - --rrdtool <path> Path to the RRDtool binary
43 - Default: $RRDtool
44 + --indir <dir> Source directory
45 + Default: $InDir
46 + --rrdtool <path> Path to the RRDtool binary
47 + Default: $RRDtool
48 + --rrdfilter <path> Path to the rrd_filter.px script
49 + Default: $RRDFilter
51 EOF
52 exit (1);
53 @@ -234,8 +245,11 @@ EOF
55 GetOptions ("indir|i=s" => \$InDir,
56 "rrdtool=s" => \$RRDtool,
57 + "rrdfilter=s" => \$RRDFilter,
58 "help|h" => \&exit_usage) or exit_usage ();
60 +print "#!/bin/bash\n\n";
61 +
62 scan_dir ($InDir);
64 # vim: set sw=2 sts=2 et fdm=marker :