1 # Utility drawer for Nagios plugins.
3 # This will be deprecated soon. Please use Nagios::Plugin from CPAN
10 @EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage);
13 #use vars($TIMEOUT %ERRORS);
14 sub print_revision ($$);
19 ## updated by autoconf
20 $PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ;
21 $PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ;
22 $PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;
23 $PATH_TO_MAILQ = "@PATH_TO_MAILQ@";
24 $PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@";
28 %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
30 ## utility subroutines
31 sub print_revision ($$) {
32 my $commandName = shift;
33 my $pluginRevision = shift;
34 print "$commandName v$pluginRevision (@PACKAGE@ @VERSION@)\n";
39 my $support='@SUPPORT@';
41 $support =~ s/\\n/\n/g;
48 exit $ERRORS{'UNKNOWN'};
53 return 0 unless defined $host1;
54 if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) {
55 if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
60 } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\.?$/) {