PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` # Utility drawer for Nagios plugins. # # This will be deprecated soon. Please use Nagios::Plugin from CPAN # for new plugins package utils; require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); #use strict; #use vars($TIMEOUT %ERRORS); sub print_revision ($$); sub usage; sub support(); sub is_hostname; ## updated by autoconf $PATH_TO_SUDO = "/usr/bin/sudo"; $PATH_TO_RPCINFO = "/usr/sbin/rpcinfo" ; $PATH_TO_LMSTAT = "" ; $PATH_TO_SMBCLIENT = "/usr/bin/smbclient" ; $PATH_TO_MAILQ = "/usr/bin/mailq"; $PATH_TO_QMAIL_QSTAT = ""; # Hardcoded values (autotools patch will be provided to the uptream project) $PATH_TO_NTPDATE = "/usr/sbin/ntpdate"; $PATH_TO_NTPQ = "/usr/sbin/ntpq"; ## common variables $TIMEOUT = 15; %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); ## utility subroutines sub print_revision ($$) { my $commandName = shift; my $pluginRevision = shift; print "$commandName v$pluginRevision (nagios-plugins 2.4.9)\n"; print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"; } sub support () { my $support='Send email to help@nagios-plugins.org if you have questions regarding use\nof this software. To submit patches or suggest improvements, send email to\ndevel@nagios-plugins.org. Please include version information with all\ncorrespondence (when possible, use output from the --version option of the\nplugin itself).\n'; $support =~ s/@/\@/g; $support =~ s/\\n/\n/g; print $support; } sub usage { my $format=shift; printf($format,@_); exit $ERRORS{'UNKNOWN'}; } sub is_hostname { my $host1 = shift; return 0 unless defined $host1; if ($host1 =~ m/^[\d\.]+$/ && $host1 !~ /\.$/) { if ($host1 =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { return 1; } else { return 0; } } elsif ($host1 =~ m/^[a-zA-Z0-9][-a-zA-Z0-9]*(\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\.?$/) { return 1; } else { return 0; } } 1;