X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=contrib%2Fcollection.cgi;h=791976027827adba69de670ca6c93b97d67b6a9b;hb=7e4b7b46592718cafa5f21ce03bd10dcf919a26d;hp=a40db874c02295bfa7cd7e45bec10ab3abea2557;hpb=4320ac5ec142c87bcf634cd85b89eadea65011ff;p=collectd.git diff --git a/contrib/collection.cgi b/contrib/collection.cgi index a40db874..79197602 100755 --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@ -944,10 +944,10 @@ sub load_graph_definitions 'GPRINT:max:MAX:%5.1lf%s Max,', 'GPRINT:avg:LAST:%5.1lf%s Last\l' ], - charge => [ - 'DEF:avg={file}:charge:AVERAGE', - 'DEF:min={file}:charge:MIN', - 'DEF:max={file}:charge:MAX', + charge => ['-v', 'Ah', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', "AREA:max#$HalfBlue", "AREA:min#$Canvas", "LINE1:avg#$FullBlue:Charge", @@ -956,18 +956,6 @@ sub load_graph_definitions 'GPRINT:max:MAX:%5.1lf%sAh Max,', 'GPRINT:avg:LAST:%5.1lf%sAh Last\l' ], - charge_percent => [ - 'DEF:avg={file}:percent:AVERAGE', - 'DEF:min={file}:percent:MIN', - 'DEF:max={file}:percent:MAX', - "AREA:max#$HalfBlue", - "AREA:min#$Canvas", - "LINE1:avg#$FullBlue:Charge", - 'GPRINT:min:MIN:%5.1lf%s%% Min,', - 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,', - 'GPRINT:max:MAX:%5.1lf%s%% Max,', - 'GPRINT:avg:LAST:%5.1lf%s%% Last\l' - ], cpu => ['-v', 'CPU load', 'DEF:avg={file}:value:AVERAGE', 'DEF:min={file}:value:MIN', @@ -980,10 +968,10 @@ sub load_graph_definitions 'GPRINT:max:MAX:%6.2lf%% Max,', 'GPRINT:avg:LAST:%6.2lf%% Last\l' ], - current => [ - 'DEF:avg={file}:current:AVERAGE', - 'DEF:min={file}:current:MIN', - 'DEF:max={file}:current:MAX', + current => ['-v', 'Ampere', + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', "AREA:max#$HalfBlue", "AREA:min#$Canvas", "LINE1:avg#$FullBlue:Current", @@ -2332,6 +2320,8 @@ sub load_graph_definitions $GraphDefs->{'if_tx_errors'} = $GraphDefs->{'if_rx_errors'}; $MetaGraphDefs->{'cpu'} = \&meta_graph_cpu; + $MetaGraphDefs->{'if_rx_errors'} = \&meta_graph_if_rx_errors; + $MetaGraphDefs->{'if_tx_errors'} = \&meta_graph_if_rx_errors; $MetaGraphDefs->{'memory'} = \&meta_graph_memory; $MetaGraphDefs->{'nfs_procedure'} = \&meta_graph_nfs_procedure; $MetaGraphDefs->{'ps_state'} = \&meta_graph_ps_state; @@ -2381,17 +2371,21 @@ sub meta_graph_generic_stack qq#CDEF:${inst_name}_nnl=${inst_name}_avg,UN,0,${inst_name}_avg,IF#); } - for (my $i = 0; $i < @$sources; $i++) { - my $inst_data0 = $sources->[@$sources - (1 + $i)]; - my $inst_data1 = $sources->[@$sources - (($i == 0) ? 1 : $i)]; + my $inst_data = $sources->[@$sources - 1]; + my $inst_name = $inst_data->{'name'}; + + push (@cmd, qq#CDEF:${inst_name}_stk=${inst_name}_nnl#); + } + for (my $i = 1; $i < @$sources; $i++) + { + my $inst_data0 = $sources->[@$sources - ($i + 1)]; + my $inst_data1 = $sources->[@$sources - $i]; my $inst_name0 = $inst_data0->{'name'}; my $inst_name1 = $inst_data1->{'name'}; - my $cdef_name = ($i == 0) ? 'nnl' : 'stk'; - - push (@cmd, qq#CDEF:${inst_name0}_stk=${inst_name0}_nnl,${inst_name1}_${cdef_name},+#); + push (@cmd, qq#CDEF:${inst_name0}_stk=${inst_name0}_nnl,${inst_name1}_stk,+#); } for (my $i = 0; $i < @$sources; $i++) @@ -2511,7 +2505,7 @@ sub meta_graph_memory . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type"; $opts->{'number_format'} = '%5.1lf%s'; - $opts->{'rrd_opts'} = ['-b', '1024']; + $opts->{'rrd_opts'} = ['-b', '1024', '-v', 'Bytes']; my @files = (); @@ -2553,6 +2547,53 @@ sub meta_graph_memory return (meta_graph_generic_stack ($opts, $sources)); } # meta_graph_cpu +sub meta_graph_if_rx_errors +{ + confess ("Wrong number of arguments") if (@_ != 5); + + my $host = shift; + my $plugin = shift; + my $plugin_instance = shift; + my $type = shift; + my $type_instances = shift; + + my $opts = {}; + my $sources = []; + + $opts->{'title'} = "$host/$plugin" + . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type"; + $opts->{'number_format'} = '%5.2lf'; + $opts->{'rrd_opts'} = ['-v', 'Errors/s']; + + my @files = (); + + for (sort @$type_instances) + { + my $inst = $_; + my $file = ''; + my $title = $opts->{'title'}; + + for (@DataDirs) + { + if (-e "$_/$title-$inst.rrd") + { + $file = "$_/$title-$inst.rrd"; + last; + } + } + confess ("No file found for $title") if ($file eq ''); + + push (@$sources, + { + name => $inst, + file => $file + } + ); + } # for (@$type_instances) + + return (meta_graph_generic_stack ($opts, $sources)); +} # meta_graph_if_rx_errors + sub meta_graph_mysql_commands { confess ("Wrong number of arguments") if (@_ != 5); @@ -2724,10 +2765,10 @@ sub meta_graph_swap $opts->{'colors'} = { - 'Free' => '00e000', - 'Cached' => '0000ff', - 'Reserved' => 'ffb000', - 'Used' => 'ff0000' + 'Free' => '00e000', + 'Cached' => '0000ff', + 'Reserved' => 'ffb000', + 'Used' => 'ff0000' }; _custom_sort_arrayref ($type_instances,