summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c48289c)
raw | patch | inline | side by side (parent: c48289c)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 2 Sep 2007 17:28:09 +0000 (19:28 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 2 Sep 2007 17:28:09 +0000 (19:28 +0200) |
contrib/collection.cgi | patch | blob | history |
diff --git a/contrib/collection.cgi b/contrib/collection.cgi
index cffe63b3d5a06e0575038b161ea8cde90026bf44..09bbec7bb71617d69bec2ade9ac8ae6af22d3a8f 100755 (executable)
--- a/contrib/collection.cgi
+++ b/contrib/collection.cgi
"DEF:val_max={file}:value:MAX",
"AREA:val_max#$HalfBlue",
"AREA:val_min#$Canvas",
- "LINE1:val_avg#$FullBlue:{inst}",
+ "LINE1:val_avg#$FullBlue:Issues/s",
'GPRINT:val_min:MIN:%5.2lf Min,',
'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
'GPRINT:val_max:MAX:%5.2lf Max,',
"DEF:val_max={file}:value:MAX",
"AREA:val_max#$HalfBlue",
"AREA:val_min#$Canvas",
- "LINE1:val_avg#$FullBlue:{inst}",
+ "LINE1:val_avg#$FullBlue:Issues/s",
'GPRINT:val_min:MIN:%5.2lf Min,',
'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
'GPRINT:val_max:MAX:%5.2lf Max,',
'DEF:temp_min={file}:value:MIN',
'DEF:temp_max={file}:value:MAX',
'CDEF:average=temp_avg,0.2,*,PREV,UN,temp_avg,PREV,IF,0.8,*,+',
- 'CDEF:derivative=PREV(average),average,-',
- 'CDEF:rising=derivative,-0.01,LT,INF,UNKN,IF',
- 'CDEF:falling=derivative,0.01,GT,INF,UNKN,IF',
- "AREA:rising#f0fff0",
- "AREA:falling#fff0f0",
"AREA:temp_max#$HalfRed",
"AREA:temp_min#$Canvas",
- #"LINE1:average#000000",
"LINE1:temp_avg#$FullRed:Temperature",
'GPRINT:temp_min:MIN:%4.1lf Min,',
'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
$MetaGraphDefs->{'cpu'} = \&meta_graph_cpu;
$MetaGraphDefs->{'memory'} = \&meta_graph_memory;
+ $MetaGraphDefs->{'nfs_procedure'} = \&meta_graph_nfs_procedure;
+ $MetaGraphDefs->{'ps_state'} = \&meta_graph_ps_state;
+ $MetaGraphDefs->{'swap'} = \&meta_graph_swap;
+ $MetaGraphDefs->{'mysql_commands'} = \&meta_graph_mysql_commands;
+ $MetaGraphDefs->{'mysql_handler'} = \&meta_graph_mysql_commands;
} # load_graph_definitions
sub meta_graph_generic_stack
qq(GPRINT:${inst_name}_min:MIN:$number_format Min,),
qq(GPRINT:${inst_name}_avg:AVERAGE:$number_format Avg,),
qq(GPRINT:${inst_name}_max:MAX:$number_format Max,),
- qq(GPRINT:${inst_name}_avg:LAST:$number_format Last\l),
+ qq(GPRINT:${inst_name}_avg:LAST:$number_format Last\\l),
);
}
return (meta_graph_generic_stack ($opts, $sources));
} # meta_graph_cpu
+sub meta_graph_mysql_commands
+{
+ 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';
+
+ 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_mysql_commands
+
+sub meta_graph_nfs_procedure
+{
+ 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.1lf%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_nfs_procedure
+
+sub meta_graph_ps_state
+{
+ 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";
+
+ my @files = ();
+
+ $opts->{'colors'} =
+ {
+ 'Running' => '00e000',
+ 'Sleeping' => '0000ff',
+ 'Paging' => 'ffb000',
+ 'Zombies' => 'ff0000',
+ 'Blocked' => 'ff00ff',
+ 'Stopped' => 'a000a0'
+ };
+
+ _custom_sort_arrayref ($type_instances,
+ [qw(paging blocked zombies stopped running sleeping)]);
+
+ for (@$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 => ucfirst ($inst),
+ file => $file
+ }
+ );
+ } # for (@$type_instances)
+
+ return (meta_graph_generic_stack ($opts, $sources));
+} # meta_graph_ps_state
+
+sub meta_graph_swap
+{
+ 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.1lf%s';
+
+ my @files = ();
+
+ $opts->{'colors'} =
+ {
+ 'Free' => '00e000',
+ 'Cached' => '0000ff',
+ 'Reserved' => 'ffb000',
+ 'Used' => 'ff0000'
+ };
+
+ _custom_sort_arrayref ($type_instances,
+ [qw(free cached reserved used)]);
+
+ for (@$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 => ucfirst ($inst),
+ file => $file
+ }
+ );
+ } # for (@$type_instances)
+
+ return (meta_graph_generic_stack ($opts, $sources));
+} # meta_graph_swap
+
# vim: shiftwidth=2:softtabstop=2:tabstop=8