1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
*** nagios-plugins-1.3.1/plugins-scripts/check_ifoperstatus.pl Wed Feb 12 05:32:20 2003
--- check_ifoperstatus.pl Thu Aug 19 15:34:22 2004
***************
*** 78,83 ****
--- 78,84 ----
my $key;
my $lastc;
my $dormantWarn;
+ my $adminWarn;
my $name;
***************
*** 104,110 ****
"H=s" => \$hostname, "hostname=s" => \$hostname,
"I" => \$ifXTable, "ifmib" => \$ifXTable,
"n=s" => \$ifName, "name=s" => \$ifName,
! "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn );
--- 105,112 ----
"H=s" => \$hostname, "hostname=s" => \$hostname,
"I" => \$ifXTable, "ifmib" => \$ifXTable,
"n=s" => \$ifName, "name=s" => \$ifName,
! "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
! "a=s" => \$adminWarn, "admin-down=s" => \$adminWarn );
***************
*** 235,243 ****
## 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.";
!
}
## Check operational status
elsif ( $response->{$snmpIfOperStatus} == 2 ) {
--- 237,252 ----
## if AdminStatus is down - some one made a consious effort to change config
##
if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
! $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 ) {
***************
*** 246,252 ****
} elsif ( $response->{$snmpIfOperStatus} == 5 ) {
if (defined $dormantWarn ) {
if ($dormantWarn eq "w") {
! $state = 'WARNNG';
$answer = "Interface $name (index $snmpkey) is dormant.";
}elsif($dormantWarn eq "c") {
$state = 'CRITICAL';
--- 255,261 ----
} elsif ( $response->{$snmpIfOperStatus} == 5 ) {
if (defined $dormantWarn ) {
if ($dormantWarn eq "w") {
! $state = 'WARNING';
$answer = "Interface $name (index $snmpkey) is dormant.";
}elsif($dormantWarn eq "c") {
$state = 'CRITICAL';
***************
*** 343,348 ****
--- 352,358 ----
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 " -a (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n";
printf " -V (--version) Plugin version\n";
printf " -h (--help) usage help \n\n";
printf " -k or -d must be specified\n\n";
|