PDA

View Full Version : Check_hylafax


chrisOreon
4th April 2007, 12:55
Ce plug marche pas
merci

./check_hylafax.pl --help
Can't locate utils.pm in @INC (@INC contains: /usr/lib/nagios/plugins /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at ./check_hylafax.pl line 7.
BEGIN failed--compilation aborted at ./check_hylafax.pl line 7.




le plug



#! /usr/bin/perl -wT

use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_H $opt_P $opt_w $opt_c $opt_l $opt_p $PROGNAME);
use lib "/usr/lib/nagios/plugins" ;
use utils qw(%ERRORS &print_revision &support &usage);
use Net::FTP;

$PROGNAME = "check_hylafax";

sub print_help ();
sub print_usage ();

$ENV{'PATH'}='';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';

Getopt::Long::Configure('bundling');
GetOptions
("V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"w=s" => \$opt_w, "warning=s" => \$opt_w,
"c=s" => \$opt_c, "critical=s" => \$opt_c,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"P=i" => \$opt_P, "port=i" => \$opt_P,
"l=s" => \$opt_l, "login=s" => \$opt_l,
"p=s" => \$opt_p, "password=s" => \$opt_p,
);

if ($opt_V) {
print_revision($PROGNAME,'$Revision: 1.0 $');
exit $ERRORS{'OK'};
}

if ($opt_h) {print_help(); exit $ERRORS{'OK'};}

my $host = ($opt_H ? $opt_H : "localhost");
usage("Invalid host: $opt_H\n") unless $host =~ /^[-.A-Za-z0-9]+$/;

my $port = ($opt_P ? $opt_P : "4559");
usage("Invalid port: $opt_P\n") unless ($port > 1 and $port < 32767);

usage("Warning threshold not specified\n") if not $opt_w;
my $warning = $opt_w;
usage("Invalid warning threshold: $opt_w\n") unless $warning =~ /^\d+$/;

usage("Critical threshold not specified\n") if not $opt_c;
my $critical = $opt_c;
usage("Invalid critical threshold: $opt_c\n") unless $critical =~ /^\d+$/;

#($opt_c) || usage("Critical threshold not specified\n");
#my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
#($critical) || usage("Invalid critical threshold: $opt_c\n");

my $sig=0;
my $ftp = Net::FTP->new($host, Port => $port);
if (not $ftp) {
print "ERROR: Can't connect to $opt_h: $@\n";
exit $ERRORS{'UNKNOWN'};
}
if (not $ftp->login($opt_l, $opt_p)) {
print "ERROR: Can't login to $opt_h: $@\n";
exit $ERRORS{'UNKNOWN'};
}
my @jobs = $ftp->ls("sendq");
$ftp->quit;
$sig = scalar(@jobs);

my $err = "OK";
if ($sig >= $critical) {
$err = "CRITICAL";
} elsif ($sig >= $warning) {
$err = "WARNING";
}
print "$err: $sig jobs in queue\n";
exit $ERRORS{$err};

sub print_usage () {
print "Usage: $PROGNAME [-H host] [-P port] [-l login] [-p password] -w <warn> -c <crit>\n";
print "\n";
print "Required Arguments:\n";
print " -w, --warning==INTEGER\n";
print " generate warning state if job count is greater than this number\n";
print " -c, --critical==INTEGER\n";
print " generate critical state if job count is greater than this number\n";
print "\nOptional Arguments:\n";
print " -H, --hostname=STRING\n";
print " connect to this host. Default is localhost.\n";
print " -P, --port=INTEGER\n";
print " connect to this port. Default is 4559.\n";
print " -l, --login=STRING\n";
print " connect using this login name.\n";
print " -p, --password=STRING\n";
print " connect using this password.\n";
print "\n";
}

sub print_help () {
print_revision($PROGNAME,'$Revision: 1.0 $');
print "Created by Adam Fox, November 2004

This plugin reports how many jobs are in a HylaFAX fax queue.

";
print_usage();
support();
}

DonKiShoot
4th April 2007, 13:11
La réponse est sous ton nez :

Can't locate utils.pm in @INC (@INC contains: /usr/lib/nagios/plugins /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl) at ./check_hylafax.pl line 7.
BEGIN failed--compilation aborted at ./check_hylafax.pl line 7.

Cherche utils.pm et demande toi pourquoi le plugin ne le trouve pas.
Le plugin n'est peut-être pas installé au bonne endroit tout simplement.

Sinon edit cette variable car le chemin me parait tout nase :

use lib "/usr/lib/nagios/plugins" ;

par

use lib "/usr/local/nagios/libexec";

chrisOreon
4th April 2007, 15:31
Merci ca fonctionne j accede au check hylafax --help

MAIS

./check_hylafax.pl --help
check_hylafax (nagios-plugins 1.4.3) 1.0
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Created by Adam Fox, November 2004

This plugin reports how many jobs are in a HylaFAX fax queue.

Usage: check_hylafax [-H host] [-P port] [-l login] [-p password] -w <warn> -c <crit>

Required Arguments:
-w, --warning==INTEGER
generate warning state if job count is greater than this number
-c, --critical==INTEGER
generate critical state if job count is greater than this number

Optional Arguments:
-H, --hostname=STRING
connect to this host. Default is localhost.
-P, --port=INTEGER
connect to this port. Default is 4559.
-l, --login=STRING
connect using this login name.
-p, --password=STRING
connect using this password.

Send email to nagios-users@lists.sourceforge.net if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to nagiosplug-devel@lists.sourceforge.net.
Please include version information with all correspondence (when possible,
use output from the --version option of the plugin itself).
root@NagiosOreon:/usr/local/nagios/libexec# ./check_hylafax.pl -H 192.168.0.8 -w 1 -c 10
Insecure dependency in connect while running with -T switch at /usr/lib/perl/5.8/IO/Socket.pm line 114.
root@NagiosOreon:/usr/local/nagios/libexec#