summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4d7724)
raw | patch | inline | side by side (parent: b4d7724)
author | Matthew Kent <mattkent@users.sourceforge.net> | |
Tue, 7 Dec 2004 03:13:14 +0000 (03:13 +0000) | ||
committer | Matthew Kent <mattkent@users.sourceforge.net> | |
Tue, 7 Dec 2004 03:13:14 +0000 (03:13 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1010 f882894a-f735-0410-b71e-b25c423dba1c
plugins-scripts/check_ifoperstatus.pl | patch | blob | history |
index a43e9f4d2fa7eae98089e77a4914a82dbbde4eb3..59356bd7a21e65b4f6b34cce9184b455c6560784 100644 (file)
my $key;
my $lastc;
my $dormantWarn;
+my $adminWarn;
my $name;
### Validate Arguments
## if AdminStatus is down - some one made a consious effort to change config
##
if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
- $state = 'WARNING';
- $answer = "Interface $name (index $snmpkey) is administratively down.";
-
+ $answer = "Interface $name (index $snmpkey) is administratively down.";
+ if ( not defined $adminWarn or $adminWarn eq "w" ) {
+ $state = 'WARNING';
+ } elsif ( $adminWarn eq "i" ) {
+ $state = 'OK';
+ } elsif ( $adminWarn eq "c" ) {
+ $state = 'CRITICAL';
+ } else { # If wrong value for -a, say warning
+ $state = 'WARNING';
+ }
}
## Check operational status
elsif ( $response->{$snmpIfOperStatus} == 2 ) {
} elsif ( $response->{$snmpIfOperStatus} == 5 ) {
if (defined $dormantWarn ) {
if ($dormantWarn eq "w") {
- $state = 'WARNNG';
+ $state = 'WARNING';
$answer = "Interface $name (index $snmpkey) is dormant.";
}elsif($dormantWarn eq "c") {
$state = 'CRITICAL';
printf " -n (--name) the value should match the returned ifName\n";
printf " (Implies the use of -I)\n";
printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n";
+ printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n";
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
printf " -V (--version) Plugin version\n";
"l=s" => \$lastc, "lastchange=s" => \$lastc,
"p=i" => \$port, "port=i" =>\$port,
"H=s" => \$hostname, "hostname=s" => \$hostname,
- "I" => \$ifXTable, "ifmib" => \$ifXTable,
+ "I" => \$ifXTable, "ifmib" => \$ifXTable,
"n=s" => \$ifName, "name=s" => \$ifName,
"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
+ "D=s" => \$adminWarn, "admin-down=s" => \$adminWarn,
"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
"t=i" => \$timeout, "timeout=i" => \$timeout,
);