summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c553f66)
raw | patch | inline | side by side (parent: c553f66)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 21 Oct 2006 12:38:01 +0000 (14:38 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 21 Oct 2006 12:38:01 +0000 (14:38 +0200) |
contrib/collection.cgi | patch | blob | history |
diff --git a/contrib/collection.cgi b/contrib/collection.cgi
index a0fc4fc9b0bdfb34cbf4bc958220fcf7e9645be6..fb76f603aa3794bfd358bf248fe7f6900ddae315 100755 (executable)
--- a/contrib/collection.cgi
+++ b/contrib/collection.cgi
'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',
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'],
mysql_handler => \&output_graph_mysql_handler,
partition => 1,
ping => \&output_graph_ping,
+ qtype => \&output_graph_named_qtype,
sensors => 1,
traffic => 1,
users => 1,
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}));