summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3f9ccbd)
raw | patch | inline | side by side (parent: 3f9ccbd)
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 8 May 2002 05:10:35 +0000 (05:10 +0000) | ||
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | |
Wed, 8 May 2002 05:10:35 +0000 (05:10 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@26 f882894a-f735-0410-b71e-b25c423dba1c
plugins-scripts/utils.pm.in | patch | blob | history |
index 361bfe99c2d314978882f95e33783aa512064f1a..ed105ddaf1f765d112e6629240ecfcf2dc809590 100644 (file)
+# 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;
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;
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;