1 # Utility drawer for Monitoring Plugins.
3 # This will be deprecated soon. Please use Monitoring::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_SUDO = "@PATH_TO_SUDO@";
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@";
26 $PATH_TO_SNMPGET = "@PATH_TO_SNMPGET@";
30 %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
32 ## utility subroutines
33 sub print_revision ($$) {
34 my $commandName = shift;
35 my $pluginRevision = shift;
36 print "$commandName v$pluginRevision (@PACKAGE@ @VERSION@)\n";
41 my $support='@SUPPORT@';
43 $support =~ s/\\n/\n/g;
50 exit $ERRORS{'UNKNOWN'};
55 return 0 unless defined $host1;
56 if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) {
57 if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
62 } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\.?$/) {