mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-13 08:44:46 +02:00
+ Fix output when no vm on the datastore
This commit is contained in:
parent
c39d908c15
commit
eaf8b91988
@ -155,6 +155,12 @@ sub run {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scalar(@vm_array) == 0) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => "No virtual machines on the datastore");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
@properties = ('name', 'runtime.connectionState', 'runtime.powerState');
|
@properties = ('name', 'runtime.connectionState', 'runtime.powerState');
|
||||||
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
|
my $result2 = centreon::vmware::common::get_views($self->{connector}, \@vm_array, \@properties);
|
||||||
return if (!defined($result2));
|
return if (!defined($result2));
|
||||||
@ -170,6 +176,12 @@ sub run {
|
|||||||
$ref_ids_vm{${$result2}[$i]->{mo_ref}->{value}} = ${$result2}[$i]->{name};
|
$ref_ids_vm{${$result2}[$i]->{mo_ref}->{value}} = ${$result2}[$i]->{name};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($multiple == 0 && scalar(@{$result2}) == 0) {
|
||||||
|
$self->{manager}->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => "No active virtual machines on the datastore");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
# Vsphere >= 4.1
|
# Vsphere >= 4.1
|
||||||
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
|
||||||
$result2,
|
$result2,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user