diff options
Diffstat (limited to 'plugins-scripts/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl index a43e9f4..59356bd 100644 --- a/plugins-scripts/check_ifoperstatus.pl +++ b/plugins-scripts/check_ifoperstatus.pl | |||
@@ -86,6 +86,7 @@ my $ifdescr; | |||
86 | my $key; | 86 | my $key; |
87 | my $lastc; | 87 | my $lastc; |
88 | my $dormantWarn; | 88 | my $dormantWarn; |
89 | my $adminWarn; | ||
89 | my $name; | 90 | my $name; |
90 | 91 | ||
91 | ### Validate Arguments | 92 | ### Validate Arguments |
@@ -168,9 +169,16 @@ push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; | |||
168 | ## if AdminStatus is down - some one made a consious effort to change config | 169 | ## if AdminStatus is down - some one made a consious effort to change config |
169 | ## | 170 | ## |
170 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { | 171 | if ( not ($response->{$snmpIfAdminStatus} == 1) ) { |
171 | $state = 'WARNING'; | 172 | $answer = "Interface $name (index $snmpkey) is administratively down."; |
172 | $answer = "Interface $name (index $snmpkey) is administratively down."; | 173 | if ( not defined $adminWarn or $adminWarn eq "w" ) { |
173 | 174 | $state = 'WARNING'; | |
175 | } elsif ( $adminWarn eq "i" ) { | ||
176 | $state = 'OK'; | ||
177 | } elsif ( $adminWarn eq "c" ) { | ||
178 | $state = 'CRITICAL'; | ||
179 | } else { # If wrong value for -a, say warning | ||
180 | $state = 'WARNING'; | ||
181 | } | ||
174 | } | 182 | } |
175 | ## Check operational status | 183 | ## Check operational status |
176 | elsif ( $response->{$snmpIfOperStatus} == 2 ) { | 184 | elsif ( $response->{$snmpIfOperStatus} == 2 ) { |
@@ -179,7 +187,7 @@ push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; | |||
179 | } elsif ( $response->{$snmpIfOperStatus} == 5 ) { | 187 | } elsif ( $response->{$snmpIfOperStatus} == 5 ) { |
180 | if (defined $dormantWarn ) { | 188 | if (defined $dormantWarn ) { |
181 | if ($dormantWarn eq "w") { | 189 | if ($dormantWarn eq "w") { |
182 | $state = 'WARNNG'; | 190 | $state = 'WARNING'; |
183 | $answer = "Interface $name (index $snmpkey) is dormant."; | 191 | $answer = "Interface $name (index $snmpkey) is dormant."; |
184 | }elsif($dormantWarn eq "c") { | 192 | }elsif($dormantWarn eq "c") { |
185 | $state = 'CRITICAL'; | 193 | $state = 'CRITICAL'; |
@@ -286,6 +294,7 @@ sub print_help() { | |||
286 | printf " -n (--name) the value should match the returned ifName\n"; | 294 | printf " -n (--name) the value should match the returned ifName\n"; |
287 | printf " (Implies the use of -I)\n"; | 295 | printf " (Implies the use of -I)\n"; |
288 | printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n"; | 296 | printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n"; |
297 | printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n"; | ||
289 | printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; | 298 | printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; |
290 | printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; | 299 | printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; |
291 | printf " -V (--version) Plugin version\n"; | 300 | printf " -V (--version) Plugin version\n"; |
@@ -316,9 +325,10 @@ sub process_arguments() { | |||
316 | "l=s" => \$lastc, "lastchange=s" => \$lastc, | 325 | "l=s" => \$lastc, "lastchange=s" => \$lastc, |
317 | "p=i" => \$port, "port=i" =>\$port, | 326 | "p=i" => \$port, "port=i" =>\$port, |
318 | "H=s" => \$hostname, "hostname=s" => \$hostname, | 327 | "H=s" => \$hostname, "hostname=s" => \$hostname, |
319 | "I" => \$ifXTable, "ifmib" => \$ifXTable, | 328 | "I" => \$ifXTable, "ifmib" => \$ifXTable, |
320 | "n=s" => \$ifName, "name=s" => \$ifName, | 329 | "n=s" => \$ifName, "name=s" => \$ifName, |
321 | "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn, | 330 | "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn, |
331 | "D=s" => \$adminWarn, "admin-down=s" => \$adminWarn, | ||
322 | "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, | 332 | "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, |
323 | "t=i" => \$timeout, "timeout=i" => \$timeout, | 333 | "t=i" => \$timeout, "timeout=i" => \$timeout, |
324 | ); | 334 | ); |