From: Florian Forster Date: Sat, 21 Oct 2006 12:38:01 +0000 (+0200) Subject: collection.cgi: Added `qtype' X-Git-Tag: collectd-3.11.0~42^2~9 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4e809534d43912a3046429ccc53f23778081072a;p=collectd.git collection.cgi: Added `qtype' --- diff --git a/contrib/collection.cgi b/contrib/collection.cgi index a0fc4fc9..fb76f603 100755 --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@ -791,6 +791,18 @@ our $GraphDefs; 'GPRINT:major_max:MAX:%5.1lf%s Max,', 'GPRINT:major_avg:LAST:%5.1lf%s Last\l' ], + qtype => [ + 'DEF:avg={file}:value:AVERAGE', + 'DEF:min={file}:value:MIN', + 'DEF:max={file}:value:MAX', + "AREA:max#$HalfBlue", + "AREA:min#$Canvas", + "LINE1:avg#$FullBlue:Queries/s", + 'GPRINT:min:MIN:%9.3lf Min,', + 'GPRINT:avg:AVERAGE:%9.3lf Average,', + 'GPRINT:max:MAX:%9.3lf Max,', + 'GPRINT:avg:LAST:%9.3lf Last\l' + ], swap => [ 'DEF:used_avg={file}:used:AVERAGE', 'DEF:used_min={file}:used:MIN', @@ -1079,6 +1091,7 @@ our $GraphArgs = ps_cputime => ['-t', '{host} process {inst} CPU usage', '-v', 'Seconds'], ps_count => ['-t', '{host} process {inst} count', '-v', 'Threads/Processes'], ps_pagefaults => ['-t', '{host} process {inst} pagefaults', '-v', 'Pagefaults/s'], + qtype => ['-t', 'QType {inst}', '-v', 'Queries/s'], sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'], swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'], temperature => ['-t', '{host} temperature {inst}', '-v', '°Celsius'], @@ -1107,6 +1120,7 @@ our $GraphMulti = mysql_handler => \&output_graph_mysql_handler, partition => 1, ping => \&output_graph_ping, + qtype => \&output_graph_named_qtype, sensors => 1, traffic => 1, users => 1, @@ -1372,6 +1386,49 @@ sub output_graph_mysql_handler return (@ret); } +sub output_graph_named_qtype +{ + my @inst = @_; + my @ret = (); + + die if (@inst < 2); + + my @colors = get_n_colors (scalar (@inst)); + + for (my $i = 0; $i < scalar (@inst); $i++) + { + my $inst = $inst[$i]; + push (@ret, + "DEF:avg_$i=$AbsDir/qtype-$inst.rrd:value:AVERAGE", + "DEF:min_$i=$AbsDir/qtype-$inst.rrd:value:MIN", + "DEF:max_$i=$AbsDir/qtype-$inst.rrd:value:MAX"); + } + + for (my $i = 0; $i < scalar (@inst); $i++) + { + my $inst = $inst[$i]; + my $color = $colors[$i]; + my $type = ($i == 0) ? 'AREA' : 'STACK'; + + if (length ($inst) > 5) + { + $inst = substr ($inst, 0, 5); + } + else + { + $inst = sprintf ('%-5s', $inst); + } + + push (@ret, + "$type:avg_$i#$color:$inst", + "GPRINT:min_$i:MIN:%9.3lf Min,", + "GPRINT:avg_$i:AVERAGE:%9.3lf Avg,", + "GPRINT:max_$i:MAX:%9.3lf Max,", + "GPRINT:avg_$i:LAST:%9.3lf Last\\l"); + } + + return (@ret); +} sub output_graph { die unless (defined ($GraphDefs->{$Type}));