1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 18:38:30 +00: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"; print "graph_order";
foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) { 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"; print "\n";
@ -686,14 +686,33 @@ graph_args --base 1000
graph_vlabel errors in (-) / out (+) per \${graph_period} graph_vlabel errors in (-) / out (+) per \${graph_period}
graph_category network graph_category network
recv.label recv errors_in.label $alias
recv.type DERIVE errors_in.graph no
recv.graph no errors_in.label recv
recv.min 0 errors_in.type DERIVE
send.label Errors errors_in.min 0
send.type DERIVE errors_out.label Errors
send.negative recv errors_out.negative errors_in
send.min 0 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 END
} }
@ -729,24 +748,39 @@ sub do_fetch_if {
print "multigraph snmp_if_combined_err.$if\n"; print "multigraph snmp_if_combined_err.$if\n";
if ($status == 2) { if ($status == 2) {
print "recv.value U\n"; print <<END;
print "send.value U\n"; errors_in.value U
print "send.extinfo This interface is down\n"; 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; return;
} }
$response = ( $snmpinfo->{$if}->{ifInErrors} || 0 ) + $errors = $snmpinfo->{$if}->{ifInErrors};
( $snmpinfo->{$if}->{ifInDiscards} || 0 ); $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"; $errors = $snmpinfo->{$if}->{ifOutErrors};
$discards = $snmpinfo->{$if}->{ifOutDiscards};
$response = ( $snmpinfo->{$if}->{ifOutErrors} || 0 ) + printf("errors_out %s\n".
( $snmpinfo->{$if}->{ifOutDiscards} || 0 ); "discards_out %s\n".
"total_out %s\n",
print "send.value $response\n"; $errors || "U",
$discards || "U",
($errors || 0) + ($discards || 0)
);
} }
sub do_config { sub do_config {
my ($host,undef,$version) = Munin::Plugin::SNMP->config_session(); my ($host,undef,$version) = Munin::Plugin::SNMP->config_session();