Nagios::Plugin::JUNOS: send_query: Support fallback to JUNOS::Device::command.
This commit is contained in:
parent
2700d4d4c8
commit
0d4f3dab1a
|
@ -390,7 +390,7 @@ sub send_query
|
|||
{
|
||||
my $self = shift;
|
||||
my $query = shift;
|
||||
my $queryargs = shift;
|
||||
my $queryargs = shift || {};
|
||||
|
||||
my $res;
|
||||
my $err;
|
||||
|
@ -399,10 +399,15 @@ sub send_query
|
|||
. join(", ", map { "$_ => $queryargs->{$_}" } keys %$queryargs)
|
||||
. " to router.");
|
||||
|
||||
if (ref $queryargs) {
|
||||
if (scalar(keys %$queryargs)) {
|
||||
$res = $self->{'junos'}->$query(%$queryargs);
|
||||
} else {
|
||||
eval {
|
||||
$res = $self->{'junos'}->$query();
|
||||
};
|
||||
if ($@) {
|
||||
$res = $self->{'junos'}->command($query);
|
||||
}
|
||||
}
|
||||
|
||||
if (! ref $res) {
|
||||
|
|
Loading…
Reference in a new issue