Nagios::Plugin::JUNOS: Check, if configure() has been called.
This commit is contained in:
parent
39111edfe3
commit
f4fdf36e4e
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
package Nagios::Plugin::JUNOS;
|
package Nagios::Plugin::JUNOS;
|
||||||
|
|
||||||
|
use Carp;
|
||||||
|
|
||||||
use POSIX qw( :termios_h );
|
use POSIX qw( :termios_h );
|
||||||
|
|
||||||
use Nagios::Plugin;
|
use Nagios::Plugin;
|
||||||
|
@ -193,6 +195,10 @@ sub set_checks
|
||||||
|
|
||||||
my $err_str = "ERROR:";
|
my $err_str = "ERROR:";
|
||||||
|
|
||||||
|
if (! defined($self->{'conf'}->{'timeout'})) {
|
||||||
|
croak "No timeout set -- did you call configure()?";
|
||||||
|
}
|
||||||
|
|
||||||
if (scalar(@checks) == 0) {
|
if (scalar(@checks) == 0) {
|
||||||
$self->{'conf'}->{'checks'}[0] = {
|
$self->{'conf'}->{'checks'}[0] = {
|
||||||
name => $default,
|
name => $default,
|
||||||
|
@ -233,6 +239,10 @@ sub connect
|
||||||
my $host = $self->{'conf'}->{'host'};
|
my $host = $self->{'conf'}->{'host'};
|
||||||
my $user = $self->{'conf'}->{'user'};
|
my $user = $self->{'conf'}->{'user'};
|
||||||
|
|
||||||
|
if ((! $host) || (! $user)) {
|
||||||
|
croak "Host and/or user not set -- did you call configure()?";
|
||||||
|
}
|
||||||
|
|
||||||
if (! $self->opts->password) {
|
if (! $self->opts->password) {
|
||||||
my $term = POSIX::Termios->new();
|
my $term = POSIX::Termios->new();
|
||||||
my $lflag;
|
my $lflag;
|
||||||
|
|
Loading…
Reference in a new issue