diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-08-14 19:06:38 (GMT) |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-08-14 19:06:38 (GMT) |
commit | bb59a4ce8769f9b8533674dce341af71a4864dc0 (patch) | |
tree | 749050006bc11dcb4f60bcf322c364133eb12d21 | |
parent | 325e642ae83045f15a3b19e9f8754a46a0d68ac0 (diff) | |
download | monitoring-plugins-bb59a4ce8769f9b8533674dce341af71a4864dc0.tar.gz |
skip PPP interfaces
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@78 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-x | plugins-scripts/check_ifstatus.pl | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index f54008f..3b8a19c 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'; | |||
61 | my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; | 61 | my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; |
62 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; | 62 | my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; |
63 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; | 63 | my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; |
64 | my $snmpIfType = '1.3.6.1.2.1.2.2.1.3'; | ||
64 | my $hostname; | 65 | my $hostname; |
65 | my $session; | 66 | my $session; |
66 | my $error; | 67 | my $error; |
@@ -156,6 +157,7 @@ if ( ! $snmp_version ) { | |||
156 | push(@snmpoids,$snmpIfOperStatus); | 157 | push(@snmpoids,$snmpIfOperStatus); |
157 | push(@snmpoids,$snmpIfAdminStatus); | 158 | push(@snmpoids,$snmpIfAdminStatus); |
158 | push(@snmpoids,$snmpIfDescr); | 159 | push(@snmpoids,$snmpIfDescr); |
160 | push(@snmpoids,$snmpIfType); | ||
159 | push(@snmpoids,$snmpIfName) if ( defined $ifXTable); | 161 | push(@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 | ||
233 | sub print_help { | 236 | sub 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"; |