[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts utils.pm.in,1.1.1.1,1.2

Subhendu Ghosh sghosh at users.sourceforge.net
Tue May 7 22:11:02 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory usw-pr-cvs1:/tmp/cvs-serv2988/plugins-scripts

Modified Files:
	utils.pm.in 
Log Message:
 is_hostname added, update CODES to POSIX

Index: utils.pm.in
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/utils.pm.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** utils.pm.in	28 Feb 2002 06:43:00 -0000	1.1.1.1
--- utils.pm.in	8 May 2002 05:10:35 -0000	1.2
***************
*** 1,2 ****
--- 1,10 ----
+ # Utility drawer for Nagios plugins.
+ # $Id$
+ #
+ # $Log$
+ # Revision 1.2  2002/05/08 05:10:35  sghosh
+ #  is_hostname added, update CODES to POSIX
+ #
+ # 
  package utils;
  
***************
*** 10,16 ****
  sub usage;
  sub support();
  
  $TIMEOUT = 15;
! %ERRORS=('UNKNOWN'=>-1,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
  
  sub print_revision ($$) {
--- 18,25 ----
  sub usage;
  sub support();
+ sub is_hostname;
  
  $TIMEOUT = 15;
! %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
  
  sub print_revision ($$) {
***************
*** 34,37 ****
--- 43,55 ----
  	printf($format, at _);
  	exit $ERRORS{'UNKNOWN'};
+ }
+ 
+ sub is_hostname {
+ 	my $host1 = shift;
+ 	if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/) {
+ 		return 1;
+ 	}else{
+ 		return 0;
+ 	}
  }
  





More information about the Commits mailing list