X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=contrib%2Fmigrate-4-5.px;h=8e5a7ed44be9459cf69415e50f46664c483f8aa4;hp=1e54683ae0333848b26dbd9269678a0387de0590;hb=de407dd4e036f73e9bd4658af9d71f504fc11109;hpb=6bd4bf7b21f84746010792b885b9b71791dccb79 diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px index 1e54683a..8e5a7ed4 100755 --- a/contrib/migrate-4-5.px +++ b/contrib/migrate-4-5.px @@ -32,8 +32,8 @@ use Data::Dumper (); use File::Basename ('dirname'); our $InDir = '/var/lib/collectd'; -our $OutDir = '/tmp/collectd-5'; our $RRDtool = 'rrdtool'; +our $RRDFilter = 'rrd_filter.px'; our %TypesCounterToDerive = # {{{ ( @@ -46,7 +46,6 @@ our %TypesCounterToDerive = # {{{ connections => ["value"], cpu => ["value"], current => ["value"], - df => ["used", "free"], disk_merged => ["read", "write"], disk_octets => ["read", "write"], disk_ops => ["read", "write"], @@ -105,8 +104,6 @@ our %TypesCounterToDerive = # {{{ protocol_counter => ["value"], ps_cputime => ["user", "syst"], ps_pagefaults => ["minflt", "majflt"], - ps_code => ["value"], - ps_data => ["value"], serial_octets => ["rx", "tx"], swap_io => ["value"], virt_cpu_total => ["ns"], @@ -185,7 +182,16 @@ sub handle_file # {{{ && (!$plugin_inst) && ($type_inst)) { my $dir = join ('/', @path); - print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n"; + print "mkdir -p \"$dir/$plugin-$type_inst\"\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 @@ -224,22 +230,24 @@ migrate-4-5.px [OPTIONS] Valid options are: - --indir Source directory - Default: $InDir - --outdir Destination directory - Default: $OutDir - --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); } # }}} sub exit_usage GetOptions ("indir|i=s" => \$InDir, - "outdir|o=s" => \$OutDir, "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 :