mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-25 06:35:38 +02:00
enhancement #1228
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@9091 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
ba2996a85d
commit
feca2ed006
@ -127,6 +127,7 @@ my $start=time;
|
|||||||
|
|
||||||
my $OID_IN_ERRORS = ".1.3.6.1.2.1.2.2.1.14";
|
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_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
|
# 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};
|
$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
|
# ##### read and write in buffer file
|
||||||
# ##
|
# ##
|
||||||
@ -203,12 +217,12 @@ for (my $i = 0; $i < scalar(@nb_in_errors); $i++) {
|
|||||||
my $interface = $i+1;
|
my $interface = $i+1;
|
||||||
if ($flg_created[$i]) {
|
if ($flg_created[$i]) {
|
||||||
if (($nb_in_errors[$i] - $last_in_errors[$i] >= $critical) or ($nb_out_errors[$i] - $last_out_errors[$i] >= $critical)){
|
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";
|
$status = "CRITICAL";
|
||||||
}
|
}
|
||||||
if (($nb_in_errors[$i] - $last_in_errors[$i] >= $warning) or ($nb_out_errors[$i] - $last_out_errors[$i] >= $warning)){
|
if (($nb_in_errors[$i] - $last_in_errors[$i] >= $warning) or ($nb_out_errors[$i] - $last_out_errors[$i] >= $warning)){
|
||||||
if (!defined($msg[$i])) {
|
if (!defined($msg[$i])) {
|
||||||
$msg[$i] = "$interface:warning ";
|
$msg[$i] = $desc_tab[$i] . ":warning ";
|
||||||
}
|
}
|
||||||
if ($status ne "CRITICAL") {
|
if ($status ne "CRITICAL") {
|
||||||
$status = "WARNING";
|
$status = "WARNING";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user