'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",
'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',
'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",
"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,',
'GPRINT:val_avg:LAST:%5.2lf Last'
],
- mysql_octets => ['-v', 'Bytes/s',
+ mysql_octets => ['-v', 'Bits/s',
'DEF:out_min={file}:tx:MIN',
'DEF:out_avg={file}:tx:AVERAGE',
'DEF:out_max={file}:tx:MAX',
'DEF:inc_min={file}:rx:MIN',
'DEF:inc_avg={file}:rx:AVERAGE',
'DEF:inc_max={file}:rx:MAX',
- 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
'CDEF:mytime=out_avg,TIME,TIME,IF',
'CDEF:sample_len_raw=mytime,PREV(mytime),-',
'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
- "AREA:out_avg#$HalfGreen",
- "AREA:inc_avg#$HalfBlue",
+ 'CDEF:out_bit_min=out_min,8,*',
+ 'CDEF:out_bit_avg=out_avg,8,*',
+ 'CDEF:out_bit_max=out_max,8,*',
+ 'CDEF:inc_bit_min=inc_min,8,*',
+ 'CDEF:inc_bit_avg=inc_avg,8,*',
+ 'CDEF:inc_bit_max=inc_max,8,*',
+ 'CDEF:overlap=out_bit_avg,inc_bit_avg,GT,inc_bit_avg,out_bit_avg,IF',
+ "AREA:out_bit_avg#$HalfGreen",
+ "AREA:inc_bit_avg#$HalfBlue",
"AREA:overlap#$HalfBlueGreen",
- "LINE1:out_avg#$FullGreen:Written",
- 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
- 'GPRINT:out_max:MAX:%5.1lf%s Max,',
- 'GPRINT:out_avg:LAST:%5.1lf%s Last',
+ "LINE1:out_bit_avg#$FullGreen:Written",
+ 'GPRINT:out_bit_avg:AVERAGE:%5.1lf%s Avg,',
+ 'GPRINT:out_bit_max:MAX:%5.1lf%s Max,',
+ 'GPRINT:out_bit_avg:LAST:%5.1lf%s Last',
'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
- "LINE1:inc_avg#$FullBlue:Read ",
- 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
- 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
- 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
+ "LINE1:inc_bit_avg#$FullBlue:Read ",
+ 'GPRINT:inc_bit_avg:AVERAGE:%5.1lf%s Avg,',
+ 'GPRINT:inc_bit_max:MAX:%5.1lf%s Max,',
+ 'GPRINT:inc_bit_avg:LAST:%5.1lf%s Last',
'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
],
mysql_qcache => ['-v', 'Queries/s',
'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,',
$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;
+ $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#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++)
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),
);
}
. (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 = ();
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);
+
+ 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