1 # Utility drawer for Nagios plugins.
4 # This will be deprecated soon. Please use Nagios::Plugin from CPAN
11 @EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage);
14 #use vars($TIMEOUT %ERRORS);
15 sub print_revision ($$);
20 ## updated by autoconf
21 $PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ;
22 $PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ;
23 $PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;
24 $PATH_TO_MAILQ = "@PATH_TO_MAILQ@";
25 $PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@";
29 %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
31 ## utility subroutines
32 sub print_revision ($$) {
33 my $commandName = shift;
34 my $pluginRevision = shift;
35 $pluginRevision =~ s/^\$Revision: //;
36 $pluginRevision =~ s/ \$\s*$//;
37 print "$commandName v$pluginRevision (@PACKAGE@ @VERSION@)\n";
42 my $support='@SUPPORT@';
44 $support =~ s/\\n/\n/g;
51 exit $ERRORS{'UNKNOWN'};
56 return 0 unless defined $host1;
57 if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) {
58 if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
63 } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\.?$/) {