diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-08 05:10:35 +0000 |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-05-08 05:10:35 +0000 |
commit | 0976cd742c310675b771bf59ebc689864e70c107 (patch) | |
tree | e4a3e1f927dd30a0f171f3b22f5dede5f2c86079 | |
parent | 3f9ccbd2da5bd99967bac0efc7dfc5bb37e72b47 (diff) | |
download | monitoring-plugins-0976cd742c310675b771bf59ebc689864e70c107.tar.gz |
is_hostname added, update CODES to POSIX
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@26 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins-scripts/utils.pm.in | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins-scripts/utils.pm.in b/plugins-scripts/utils.pm.in index 361bfe99..ed105dda 100644 --- a/plugins-scripts/utils.pm.in +++ b/plugins-scripts/utils.pm.in @@ -1,3 +1,11 @@ +# 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; require Exporter; @@ -9,9 +17,10 @@ require Exporter; sub print_revision ($$); sub usage; sub support(); +sub is_hostname; $TIMEOUT = 15; -%ERRORS=('UNKNOWN'=>-1,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2); +%ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); sub print_revision ($$) { my $commandName = shift; @@ -35,4 +44,13 @@ sub usage { 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; + } +} + 1; |