From a4dbacada0790e70ebab9c4063956e41d57e2ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 12 Nov 2012 18:52:55 -0800 Subject: [PATCH] snmp__if_combined: restore the error graphing as it's done on snmp__if_multi This brings it basically on feature parity with it, and more. --- plugins/snmp/snmp__if_combined | 81 +++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 6 deletions(-) diff --git a/plugins/snmp/snmp__if_combined b/plugins/snmp/snmp__if_combined index f2503b01..26731e17 100755 --- a/plugins/snmp/snmp__if_combined +++ b/plugins/snmp/snmp__if_combined @@ -454,7 +454,11 @@ sub do_collect { # 7) lowerLayerDown 8 => 'ifOperStatus', 10 => 'ifInOctets', + 13 => 'ifInDiscards', + 14 => 'ifInErrors', 16 => 'ifOutOctets', + 19 => 'ifOutDiscards', + 20 => 'ifOutErrors', }); # ifXEntry - SNMP v2 and up only - on some devices @@ -578,6 +582,37 @@ recv$if.label $alias recv$if.graph no send$if.label $alias send$if.negative recv$if +END + } + + print < $b} keys %{$snmpinfo}) { + print " recv$if=snmp_if_combined_err.$if.recv send$if=snmp_if_combined_err.$if.send"; + } + print "\n"; + + foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) { + my $alias = $snmpinfo->{$if}->{ifDescr} || "Interface $if"; + + if (! ($alias =~ /\d+/) ) { + # If there are no numbers in the $alias add the if index + $alias .=" (if $if)"; + } + + print <{$if}->{ifHCInOctets} || @@ -683,6 +733,27 @@ sub do_fetch_if { # No response... print "send.value U\n"; } + + if_errors: + + 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"; + return; + } + + $response = ( $snmpinfo->{$if}->{ifInErrors} || 0 ) + + ( $snmpinfo->{$if}->{ifInDiscards} || 0 ); + + print "recv.value $response\n"; + + $response = ( $snmpinfo->{$if}->{ifOutErrors} || 0 ) + + ( $snmpinfo->{$if}->{ifOutDiscards} || 0 ); + + print "send.value $response\n"; } @@ -710,7 +781,5 @@ if ($ARGV[0] and $ARGV[0] eq "config") { } foreach my $if (sort {$a <=> $b} keys %{$snmpinfo}) { - print "multigraph snmp_if_combined.$if\n"; - do_fetch_if($if); }