This commit is contained in:
garnier-quentin 2020-07-31 15:11:57 +02:00
parent 948c3814be
commit d6687ae2bf
3 changed files with 16 additions and 16 deletions

View File

@ -103,12 +103,12 @@ sub run {
if (scalar(@$instances) > 0) {
push @$query_perfs, {
entity => $entity_view,
metrics => [
{label => 'datastore.totalReadLatency.average', instances => $instances},
{label => 'datastore.totalWriteLatency.average', instances => $instances}
]
};
entity => $entity_view,
metrics => [
{ label => 'datastore.totalReadLatency.average', instances => $instances },
{ label => 'datastore.totalWriteLatency.average', instances => $instances }
]
};
}
}

View File

@ -54,24 +54,24 @@ sub run {
my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => $filters);
return if (!defined($result));
my $data = {};
foreach my $entity_view (@$result) {
my $entity_value = $entity_view->{mo_ref}->{value};
$data->{$entity_value} = { name => $entity_view->summary->name, accessible => $entity_view->summary->accessible };
next if (centreon::vmware::common::is_accessible(accessible => $entity_view->summary->accessible) == 0);
# capacity 0...
if ($entity_view->summary->capacity <= 0) {
$data->{$entity_value}->{size} = 0;
next;
}
# in Bytes
$data->{$entity_value}->{size} = $entity_view->summary->capacity;
$data->{$entity_value}->{free} = $entity_view->summary->freeSpace;
my ($total_uncommited, $prct_uncommited);
my $msg_uncommited = '';
if (defined($entity_view->summary->uncommitted)) {

View File

@ -499,14 +499,14 @@ sub search_entities {
my $begin_views = [];
foreach my $scope (['scope_datacenter', 'Datacenter'], ['scope_cluster', 'ClusterComputeResource'], ['scope_host', 'HostSystem']) {
if (defined($options{command}->{$$scope[0]}) && $options{command}->{$$scope[0]} ne '') {
my $filters = { name => qr/$options{command}->{$$scope[0]}/ };
if (defined($options{command}->{$scope->[0]}) && $options{command}->{$scope->[0]} ne '') {
my $filters = { name => qr/$options{command}->{$scope->[0]}/ };
if (scalar(@$begin_views) > 0) {
my $temp_views = [];
while ((my $view = shift @$begin_views)) {
my ($status, $views) = find_entity_views(
connector => $options{command}->{connector},
view_type => $$scope[1],
view_type => $scope->[1],
properties => $properties,
filter => $filters,
begin_entity => $view,
@ -518,12 +518,12 @@ sub search_entities {
}
if (scalar(@$temp_views) == 0) {
set_response(code => 1, short_message => "Cannot find '$$scope[1]' object");
set_response(code => 1, short_message => "Cannot find '$scope->[1]' object");
return undef;
}
push @$begin_views, @$temp_views;
} else {
my ($status, $views) = find_entity_views(connector => $options{command}->{connector}, view_type => $$scope[1], properties => $properties, filter => $filters);
my ($status, $views) = find_entity_views(connector => $options{command}->{connector}, view_type => $scope->[1], properties => $properties, filter => $filters);
# We quit. No scope find
return undef if ($status <= 0);
push @$begin_views, @$views;