2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

snmp__if_combined: rewrite error handling.

Instead of just having a single "errors" value on the per-interface
error graphs, split it in errors and discards, then provide a total
for the combined graph.

This way it's possible to see more details of what's going on at the
interface level.
This commit is contained in:
Diego Elio Pettenò 2012-11-20 11:50:58 -08:00
parent 36ac271c5d
commit bfe824f76a

View File

@ -598,7 +598,7 @@ END
print "graph_order";
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) {
print " recv$if=snmp_if_combined_err.$if.recv send$if=snmp_if_combined_err.$if.send";
print " recv$if=snmp_if_combined_err.$if.total_in send$if=snmp_if_combined_err.$if.total_out";
}
print "\n";
@ -686,14 +686,33 @@ graph_args --base 1000
graph_vlabel errors in (-) / out (+) per \${graph_period}
graph_category network
recv.label recv
recv.type DERIVE
recv.graph no
recv.min 0
send.label Errors
send.type DERIVE
send.negative recv
send.min 0
errors_in.label $alias
errors_in.graph no
errors_in.label recv
errors_in.type DERIVE
errors_in.min 0
errors_out.label Errors
errors_out.negative errors_in
errors_out.type DERIVE
errors_out.min 0
discards_in.label $alias
discards_in.graph no
discards_in.type DERIVE
discards_in.min 0
discards_out.label Discards
discards_out.negative discards_in
discards_out.type DERIVE
discards_out.min 0
total_in.label $alias
total_in.graph no
total_in.type DERIVE
total_in.min 0
total_out.label $alias
total_out.graph no
total_out.type DERIVE
total_out.min 0
END
}
@ -729,24 +748,39 @@ sub do_fetch_if {
print "multigraph snmp_if_combined_err.$if\n";
if ($status == 2) {
print "recv.value U\n";
print "send.value U\n";
print "send.extinfo This interface is down\n";
print <<END;
errors_in.value U
errors_out.value U
discards_in.value U
discards_out.value U
total_in.value U
total_out.value U
send.extinfo This interface is currently down
END
return;
}
$response = ( $snmpinfo->{$if}->{ifInErrors} || 0 ) +
( $snmpinfo->{$if}->{ifInDiscards} || 0 );
$errors = $snmpinfo->{$if}->{ifInErrors};
$discards = $snmpinfo->{$if}->{ifInDiscards};
printf("errors_in %s\n".
"discards_in %s\n".
"total_in %s\n",
$errors || "U",
$discards || "U",
($errors || 0) + ($discards || 0)
);
print "recv.value $response\n";
$response = ( $snmpinfo->{$if}->{ifOutErrors} || 0 ) +
( $snmpinfo->{$if}->{ifOutDiscards} || 0 );
print "send.value $response\n";
$errors = $snmpinfo->{$if}->{ifOutErrors};
$discards = $snmpinfo->{$if}->{ifOutDiscards};
printf("errors_out %s\n".
"discards_out %s\n".
"total_out %s\n",
$errors || "U",
$discards || "U",
($errors || 0) + ($discards || 0)
);
}
sub do_config {
my ($host,undef,$version) = Munin::Plugin::SNMP->config_session();