This commit is contained in:
garnier-quentin 2021-12-17 15:52:40 +01:00
parent 095a34431a
commit 74a7bfef88
3 changed files with 27 additions and 20 deletions

View File

@ -58,13 +58,12 @@ sub run {
my $views = centreon::vmware::common::search_entities(command => $self, view_type => 'ClusterComputeResource', properties => \@properties, filter => $filters);
return if (!defined($views));
my @instances = ('*');
my $values = centreon::vmware::common::generic_performance_values_historic(
$self->{connector},
$views,
$views,
[
{ label => 'cpu.usage.average', 'instances' => \@instances},
{ label => 'cpu.usagemhz.average', 'instances' => \@instances}
{ label => 'cpu.usage.average', instances => [''] },
{ label => 'cpu.usagemhz.average', instances => [''] }
],
$self->{connector}->{perfcounter_speriod},
sampling_period => $self->{sampling_period},
@ -84,8 +83,8 @@ sub run {
my $entity_value = $view->{mo_ref}->{value};
$data->{$entity_value} = { name => $view->{name} };
my $total_cpu_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"} * 0.01));
my $total_cpu_mhz_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{$self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}));
my $total_cpu_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{ $self->{connector}->{perfcounter_cache}->{'cpu.usage.average'}->{key} . ':' } * 0.01));
my $total_cpu_mhz_average = centreon::vmware::common::simplify_number(centreon::vmware::common::convert_number($values->{$entity_value}->{ $self->{connector}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{key} . ':' }));
$data->{$entity_value}->{'interval_min'} = $interval_min;
$data->{$entity_value}->{'cpu.usage.average'} = $total_cpu_average;

View File

@ -66,23 +66,29 @@ sub run {
return if (!defined($result));
my @instances = ('*');
my $values = centreon::vmware::common::generic_performance_values_historic($self->{connector},
$result,
[{'label' => 'cpu.usage.average', 'instances' => \@instances},
{'label' => 'cpu.usagemhz.average', 'instances' => \@instances},
{'label' => 'cpu.ready.summation', 'instances' => \@instances}],
$self->{connector}->{perfcounter_speriod},
sampling_period => $self->{sampling_period}, time_shift => $self->{time_shift},
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1);
my $values = centreon::vmware::common::generic_performance_values_historic(
$self->{connector},
$result,
[
{'label' => 'cpu.usage.average', 'instances' => \@instances},
{'label' => 'cpu.usagemhz.average', 'instances' => \@instances},
{'label' => 'cpu.ready.summation', 'instances' => \@instances}
],
$self->{connector}->{perfcounter_speriod},
sampling_period => $self->{sampling_period}, time_shift => $self->{time_shift},
skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1
);
return if (centreon::vmware::common::performance_errors($self->{connector}, $values) == 1);
my $interval_sec = $self->{connector}->{perfcounter_speriod};
if (defined($self->{sampling_period}) && $self->{sampling_period} ne '') {
$interval_sec = $self->{sampling_period};
}
my $interval_min = centreon::vmware::common::get_interval_min(speriod => $self->{connector}->{perfcounter_speriod},
sampling_period => $self->{sampling_period}, time_shift => $self->{time_shift});
my $interval_min = centreon::vmware::common::get_interval_min(
speriod => $self->{connector}->{perfcounter_speriod},
sampling_period => $self->{sampling_period}, time_shift => $self->{time_shift}
);
my $data = {};
foreach my $entity_view (@$result) {
my $entity_value = $entity_view->{mo_ref}->{value};

View File

@ -112,9 +112,11 @@ sub run {
foreach my $cluster (@$clusters) {
next if (!$cluster->{'host'});
my @properties = ('name', 'vm', 'config.virtualNicManagerInfo.netConfig', 'config.product.version',
my @properties = (
'name', 'vm', 'config.virtualNicManagerInfo.netConfig', 'config.product.version',
'config.product.productLineId', 'hardware.systemInfo.vendor', 'hardware.systemInfo.model',
'hardware.systemInfo.uuid', 'runtime.powerState', 'runtime.inMaintenanceMode', 'runtime.connectionState');
'hardware.systemInfo.uuid', 'runtime.powerState', 'runtime.inMaintenanceMode', 'runtime.connectionState'
);
my $esxs = centreon::vmware::common::get_views($self->{connector}, \@{$cluster->host}, \@properties);
next if (!defined($esxs));
@ -122,7 +124,7 @@ sub run {
foreach my $esx (@$esxs) {
my %esx;
$esx{type} = "esx";
$esx{type} = 'esx';
$esx{name} = $esx->name;
$esx{os} = $esx->{'config.product.productLineId'} . ' ' . $esx->{'config.product.version'};
$esx{hardware} = $esx->{'hardware.systemInfo.vendor'} . ' ' . $esx->{'hardware.systemInfo.model'};