[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_ifoperstatus.pl,1.4,1.5 check_ifstatus.pl,1.7,1.8

Subhendu Ghosh sghosh at users.sourceforge.net
Wed Nov 5 15:00:10 CET 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv26724

Modified Files:
	check_ifoperstatus.pl check_ifstatus.pl 
Log Message:
 added plugin timeout options

Index: check_ifoperstatus.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ifoperstatus.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** check_ifoperstatus.pl	14 Oct 2003 03:15:19 -0000	1.4
--- check_ifoperstatus.pl	5 Nov 2003 22:59:41 -0000	1.5
***************
*** 48,51 ****
--- 48,52 ----
  sub process_arguments ();
  
+ my $timeout;
  my $status;
  my %ifOperStatus = 	('1','up',
***************
*** 88,91 ****
--- 89,95 ----
  my $name;
  
+ ### Validate Arguments
+ 
+ $status = process_arguments();
  
  
***************
*** 95,104 ****
       exit $ERRORS{"UNKNOWN"};
  };
- alarm($TIMEOUT);
  
! 
! ### Validate Arguments
! 
! $status = process_arguments();
  
  
--- 99,104 ----
       exit $ERRORS{"UNKNOWN"};
  };
  
! alarm($timeout);
  
  
***************
*** 288,291 ****
--- 288,292 ----
  	printf "   -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\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";
  	printf "   -h (--help)       usage help \n\n";
***************
*** 314,323 ****
  			"d=s" => \$ifdescr, "descr=s" => \$ifdescr,
  			"l=s" => \$lastc,  "lastchange=s" => \$lastc,
! 			"p=i" = >\$port,  "port=i" =>\$port,
  			"H=s" => \$hostname, "hostname=s" => \$hostname,
  			"I"	  => \$ifXTable, "ifmib" => \$ifXTable,
  			"n=s" => \$ifName, "name=s" => \$ifName,
  			"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
! 			"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize);
  
  
--- 315,326 ----
  			"d=s" => \$ifdescr, "descr=s" => \$ifdescr,
  			"l=s" => \$lastc,  "lastchange=s" => \$lastc,
! 			"p=i" => \$port,  "port=i" =>\$port,
  			"H=s" => \$hostname, "hostname=s" => \$hostname,
  			"I"	  => \$ifXTable, "ifmib" => \$ifXTable,
  			"n=s" => \$ifName, "name=s" => \$ifName,
  			"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
! 			"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
! 			"t=i" => \$timeout,    "timeout=i" => \$timeout,
! 			);
  
  
***************
*** 362,365 ****
--- 365,372 ----
  	}
  	
+ 	unless (defined $timeout) {
+ 		$timeout = $TIMEOUT;
+ 	}
+ 
  	if ($snmp_version =~ /3/ ) {
  		# Must define a security level even though default is noAuthNoPriv

Index: check_ifstatus.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_ifstatus.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ifstatus.pl	14 Oct 2003 03:14:57 -0000	1.7
--- check_ifstatus.pl	5 Nov 2003 22:59:41 -0000	1.8
***************
*** 57,60 ****
--- 57,61 ----
  			 '7','lowerLayerDown');  # down due to the state of lower layer interface(s));
  
+ my $timeout ;
  my $state = "UNKNOWN";
  my $answer = "";
***************
*** 115,119 ****
  
  
! alarm($TIMEOUT);
  
  push(@snmpoids,$snmpIfOperStatus);
--- 116,120 ----
  
  
! alarm($timeout);
  
  push(@snmpoids,$snmpIfOperStatus);
***************
*** 252,255 ****
--- 253,257 ----
  	printf "                     privacy password and authEngineID\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";
  	printf "   -h (--help)       usage help \n\n";
***************
*** 275,279 ****
  		"x:s"		=>	\$opt_x,   "exclude:s" => \$opt_x,
  		"u=s" => \$opt_u,  "unused_ports=s" => \$opt_u,
! 		"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize);
  		
  	if ($status == 0){
--- 277,283 ----
  		"x:s"		=>	\$opt_x,   "exclude:s" => \$opt_x,
  		"u=s" => \$opt_u,  "unused_ports=s" => \$opt_u,
! 		"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
! 		"t=i" => \$timeout,    "timeout=i" => \$timeout,
! 		);
  		
  	if ($status == 0){
***************
*** 291,294 ****
--- 295,301 ----
  	}
  
+ 	unless (defined $timeout) {
+ 		$timeout = $TIMEOUT;
+ 	}
  
  	if ($snmp_version =~ /3/ ) {





More information about the Commits mailing list