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) { if (scalar(@$instances) > 0) {
push @$query_perfs, { push @$query_perfs, {
entity => $entity_view, entity => $entity_view,
metrics => [ metrics => [
{label => 'datastore.totalReadLatency.average', instances => $instances}, { label => 'datastore.totalReadLatency.average', instances => $instances },
{label => 'datastore.totalWriteLatency.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); my $result = centreon::vmware::common::search_entities(command => $self, view_type => 'Datastore', properties => \@properties, filter => $filters);
return if (!defined($result)); return if (!defined($result));
my $data = {}; my $data = {};
foreach my $entity_view (@$result) { foreach my $entity_view (@$result) {
my $entity_value = $entity_view->{mo_ref}->{value}; my $entity_value = $entity_view->{mo_ref}->{value};
$data->{$entity_value} = { name => $entity_view->summary->name, accessible => $entity_view->summary->accessible }; $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); next if (centreon::vmware::common::is_accessible(accessible => $entity_view->summary->accessible) == 0);
# capacity 0... # capacity 0...
if ($entity_view->summary->capacity <= 0) { if ($entity_view->summary->capacity <= 0) {
$data->{$entity_value}->{size} = 0; $data->{$entity_value}->{size} = 0;
next; next;
} }
# in Bytes # in Bytes
$data->{$entity_value}->{size} = $entity_view->summary->capacity; $data->{$entity_value}->{size} = $entity_view->summary->capacity;
$data->{$entity_value}->{free} = $entity_view->summary->freeSpace; $data->{$entity_value}->{free} = $entity_view->summary->freeSpace;
my ($total_uncommited, $prct_uncommited); my ($total_uncommited, $prct_uncommited);
my $msg_uncommited = ''; my $msg_uncommited = '';
if (defined($entity_view->summary->uncommitted)) { if (defined($entity_view->summary->uncommitted)) {

View File

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