mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-23 21:55:16 +02:00
disable UTF8 and Regexp mode
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@3718 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
e1dbfce70f
commit
867bf78b6f
@ -41,7 +41,7 @@ if (eval "require centreon" ) {
|
||||
}
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_64bits $opt_v $opt_C $opt_b $opt_k $opt_u $opt_p $opt_H $opt_D $opt_i $opt_n $opt_w $opt_c $opt_s $opt_T);
|
||||
use vars qw($opt_V $opt_h $opt_64bits $opt_v $opt_C $opt_b $opt_k $opt_u $opt_p $opt_H $opt_D $opt_i $opt_n $opt_w $opt_c $opt_s $opt_T $opt_r);
|
||||
|
||||
# Plugin var init
|
||||
|
||||
@ -67,7 +67,7 @@ GetOptions
|
||||
"b=s" => \$opt_b, "bps=s" => \$opt_b,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||
"T=s" => \$opt_T,
|
||||
"T=s" => \$opt_T, "r" => \$opt_r,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
@ -188,10 +188,25 @@ if (!defined($session)) {
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
}
|
||||
$session->translate(Net::SNMP->TRANSLATE_NONE) if (defined($session));
|
||||
|
||||
#getting interface using its name instead of its oid index
|
||||
|
||||
if ($opt_n) {
|
||||
if ($opt_r){
|
||||
my $result = $session->get_table(Baseoid => $OID_DESC);
|
||||
if (!$result) {
|
||||
printf("ERROR: Description Table : %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
foreach my $key ( oid_lex_sort(keys %$result)) {
|
||||
if ($result->{$key} =~ m/$opt_i/) {
|
||||
my @oid_list = split (/\./,$key);
|
||||
$interface = pop (@oid_list) ;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my $result = $session->get_table(Baseoid => $OID_DESC);
|
||||
if (!$result) {
|
||||
printf("ERROR: Description Table : %s.\n", $session->error);
|
||||
@ -205,6 +220,8 @@ if ($opt_n) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my ($OID_IN, $OID_OUT, $OID_SPEED);
|
||||
if ($opt_64bits) {
|
||||
$OID_IN =$centreon{MIB2}{IF_IN_OCTET_64_BITS}.".".$interface;
|
||||
@ -474,6 +491,7 @@ sub print_usage () {
|
||||
print " -c (--crit) Signal strength at which a critical message will be generated\n";
|
||||
print " -T Max Banwidth\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -r Regexp Match Mode\n";
|
||||
print " -h (--help) usage help\n";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user