From feca2ed006e8f9fe929e7d6e90d74aadf39d50da Mon Sep 17 00:00:00 2001 From: Sylvestre Ho Date: Fri, 25 Sep 2009 10:29:34 +0000 Subject: [PATCH] enhancement #1228 git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@9091 6bcd3966-0018-0410-8128-fd23d134de7e --- src/check_centreon_snmp_packetErrors | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/check_centreon_snmp_packetErrors b/src/check_centreon_snmp_packetErrors index d91265baf..14a7b056c 100644 --- a/src/check_centreon_snmp_packetErrors +++ b/src/check_centreon_snmp_packetErrors @@ -127,6 +127,7 @@ my $start=time; my $OID_IN_ERRORS = ".1.3.6.1.2.1.2.2.1.14"; my $OID_OUT_ERRORS = ".1.3.6.1.2.1.2.2.1.20"; +my $OID_IF_DESC = ".1.3.6.1.2.1.2.2.1.2"; # create a SNMP session @@ -162,6 +163,19 @@ foreach my $err (oid_lex_sort(keys %$result_out)) { $nb_out_errors[scalar(@nb_out_errors)] = $result_out->{$err}; } +# ####### Get Interface descriptions for output +my @desc_tab; +my $if_description = $session->get_table(Baseoid => $OID_IF_DESC); +if (!defined($if_description)) { + printf("ERROR: DESCRIPTIONS ERRORS : %s.\n", $session->error); + $session->close; + exit $ERRORS{'UNKNOWN'}; +} +foreach my $desc (oid_lex_sort(keys %$if_description)) { + $desc_tab[scalar(@desc_tab)] = $if_description->{$desc}; +} + + # ############################################# # ##### read and write in buffer file # ## @@ -203,12 +217,12 @@ for (my $i = 0; $i < scalar(@nb_in_errors); $i++) { my $interface = $i+1; if ($flg_created[$i]) { if (($nb_in_errors[$i] - $last_in_errors[$i] >= $critical) or ($nb_out_errors[$i] - $last_out_errors[$i] >= $critical)){ - $msg[$i] = "$interface:critical "; + $msg[$i] = $desc_tab[$i] . ":critical "; $status = "CRITICAL"; } if (($nb_in_errors[$i] - $last_in_errors[$i] >= $warning) or ($nb_out_errors[$i] - $last_out_errors[$i] >= $warning)){ if (!defined($msg[$i])) { - $msg[$i] = "$interface:warning "; + $msg[$i] = $desc_tab[$i] . ":warning "; } if ($status ne "CRITICAL") { $status = "WARNING";