summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplugins-scripts/check_ifstatus.pl23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index f54008f2..3b8a19c2 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -61,6 +61,7 @@ my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8';
61my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; 61my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1';
62my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; 62my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18';
63my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; 63my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28';
64my $snmpIfType = '1.3.6.1.2.1.2.2.1.3';
64my $hostname; 65my $hostname;
65my $session; 66my $session;
66my $error; 67my $error;
@@ -156,6 +157,7 @@ if ( ! $snmp_version ) {
156push(@snmpoids,$snmpIfOperStatus); 157push(@snmpoids,$snmpIfOperStatus);
157push(@snmpoids,$snmpIfAdminStatus); 158push(@snmpoids,$snmpIfAdminStatus);
158push(@snmpoids,$snmpIfDescr); 159push(@snmpoids,$snmpIfDescr);
160push(@snmpoids,$snmpIfType);
159push(@snmpoids,$snmpIfName) if ( defined $ifXTable); 161push(@snmpoids,$snmpIfName) if ( defined $ifXTable);
160 162
161 163
@@ -184,17 +186,18 @@ foreach $key (keys %ifStatus) {
184 186
185 # check only if interface is administratively up 187 # check only if interface is administratively up
186 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { 188 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) {
187 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} 189 # check only if interface is not of type 23 aka PPP interface
188 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { 190 if ($ifStatus{$key}{$snmpIfType} != 23 ) {
189 $ifdown++ ; 191 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;}
190 $ifmessage .= sprintf("%s: down -> %s<BR>", 192 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) {
193 $ifdown++ ;
194 $ifmessage .= sprintf("%s: down -> %s<BR>",
191 $ifStatus{$key}{$snmpIfDescr}, 195 $ifStatus{$key}{$snmpIfDescr},
192 $ifStatus{$key}{$snmpIfName}); 196 $ifStatus{$key}{$snmpIfName});
193 197 }
194 } 198 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;}
195 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} 199 }
196 } 200 }
197 }
198 201
199 202
200 if ($ifdown > 0) { 203 if ($ifdown > 0) {
@@ -232,7 +235,7 @@ sub usage {
232 235
233sub print_help { 236sub print_help {
234 printf "check_ifstatus plugin for Nagios monitors operational \n"; 237 printf "check_ifstatus plugin for Nagios monitors operational \n";
235 printf "status of each network interface on the target host\n"; 238 printf "status of each network interface (except PPP interfaces) on the target host\n";
236 printf "\nUsage:\n"; 239 printf "\nUsage:\n";
237 printf " -H (--hostname) Hostname to query - (required)\n"; 240 printf " -H (--hostname) Hostname to query - (required)\n";
238 printf " -C (--community) SNMP read community (defaults to public,\n"; 241 printf " -C (--community) SNMP read community (defaults to public,\n";