mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-03-01 12:50:34 -05:00
39 lines
728 B
Perl
39 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;
|