mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-14 00:03:32 -05:00
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
38 lines
728 B
Perl
38 lines
728 B
Perl
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();
|
|
|
|
$TIMEOUT = 15;
|
|
%ERRORS=('UNKNOWN'=>-1,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
|
|
|
|
sub print_revision ($$) {
|
|
my $commandName = shift;
|
|
my $pluginRevision = shift;
|
|
$pluginRevision =~ s/^\$Revision: //;
|
|
$pluginRevision =~ s/ \$\s*$//;
|
|
print "$commandName (@PACKAGE@ @VERSION@) $pluginRevision\n";
|
|
print "@WARRANTY@";
|
|
}
|
|
|
|
sub support () {
|
|
my $support='@SUPPORT@';
|
|
$support =~ s/@/\@/g;
|
|
$support =~ s/\\n/\n/g;
|
|
print $support;
|
|
}
|
|
|
|
sub usage {
|
|
my $format=shift;
|
|
printf($format,@_);
|
|
exit $ERRORS{'UNKNOWN'};
|
|
}
|
|
|
|
1;
|