summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_ifoperstatus.pl
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/check_ifoperstatus.pl')
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl22
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index 588993b..1a7fbba 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -1,9 +1,9 @@
1#!/usr/local/bin/perl -w 1#!@PERL@ -w
2# 2#
3# check_ifoperstatus.pl - nagios plugin 3# check_ifoperstatus.pl - monitoring plugin
4# 4#
5# Copyright (C) 2000 Christoph Kron, 5# Copyright (C) 2000 Christoph Kron,
6# Modified 5/2002 to conform to updated Nagios Plugin Guidelines 6# Modified 5/2002 to conform to updated Monitoring Plugins Guidelines
7# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh) 7# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh)
8# Added SNMPv3 support (10/2003) 8# Added SNMPv3 support (10/2003)
9# 9#
@@ -19,10 +19,11 @@
19# 19#
20# You should have received a copy of the GNU General Public License 20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software 21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23# USA
23# 24#
24# 25#
25# Report bugs to: nagiosplug-help@lists.sourceforge.net 26# Report bugs to: help@monitoring-plugins.org
26# 27#
27# 11.01.2000 Version 1.0 28# 11.01.2000 Version 1.0
28# 29#
@@ -34,7 +35,8 @@
34 35
35use POSIX; 36use POSIX;
36use strict; 37use strict;
37use lib utils.pm ; 38use FindBin;
39use lib "$FindBin::Bin";
38use utils qw($TIMEOUT %ERRORS &print_revision &support); 40use utils qw($TIMEOUT %ERRORS &print_revision &support);
39 41
40use Net::SNMP; 42use Net::SNMP;
@@ -47,6 +49,10 @@ sub usage ($);
47sub print_usage (); 49sub print_usage ();
48sub process_arguments (); 50sub process_arguments ();
49 51
52$ENV{'PATH'}='@TRUSTED_PATH@';
53$ENV{'BASH_ENV'}='';
54$ENV{'ENV'}='';
55
50my $timeout; 56my $timeout;
51my $status; 57my $status;
52my %ifOperStatus = ('1','up', 58my %ifOperStatus = ('1','up',
@@ -97,7 +103,7 @@ my %session_opts;
97$status = process_arguments(); 103$status = process_arguments();
98 104
99 105
100# Just in case of problems, let's not hang Nagios 106# Just in case of problems, let's not hang the monitoring system
101$SIG{'ALRM'} = sub { 107$SIG{'ALRM'} = sub {
102 print ("ERROR: No snmp response from $hostname (alarm)\n"); 108 print ("ERROR: No snmp response from $hostname (alarm)\n");
103 exit $ERRORS{"UNKNOWN"}; 109 exit $ERRORS{"UNKNOWN"};
@@ -288,7 +294,7 @@ sub print_usage() {
288sub print_help() { 294sub print_help() {
289 print_revision($PROGNAME, '@NP_VERSION@'); 295 print_revision($PROGNAME, '@NP_VERSION@');
290 print_usage(); 296 print_usage();
291 printf "check_ifoperstatus plugin for Nagios monitors operational \n"; 297 printf "check_ifoperstatus plugin for monitoring operational \n";
292 printf "status of a particular network interface on the target host\n"; 298 printf "status of a particular network interface on the target host\n";
293 printf "\nUsage:\n"; 299 printf "\nUsage:\n";
294 printf " -H (--hostname) Hostname to query - (required)\n"; 300 printf " -H (--hostname) Hostname to query - (required)\n";