From 992011a060472abc209ae5738d485614cc183c6b Mon Sep 17 00:00:00 2001 From: Quentin Garnier Date: Mon, 2 Feb 2015 15:24:36 +0100 Subject: [PATCH] + Add mhz usage for cpu-host --- connectors/vmware/src/centreon/esxd/cmdcpuhost.pm | 9 +++++++-- connectors/vmware/src/centreon/esxd/cmdcpuvm.pm | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/connectors/vmware/src/centreon/esxd/cmdcpuhost.pm b/connectors/vmware/src/centreon/esxd/cmdcpuhost.pm index e4ea4202e..83c0aefdf 100644 --- a/connectors/vmware/src/centreon/esxd/cmdcpuhost.pm +++ b/connectors/vmware/src/centreon/esxd/cmdcpuhost.pm @@ -84,7 +84,7 @@ sub run { $filters{name} = qr/$self->{esx_hostname}/; } - my @properties = ('name', 'runtime.connectionState'); + my @properties = ('name', 'runtime.connectionState', 'summary.hardware.numCpuCores', 'summary.hardware.cpuMhz'); my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties); return if (!defined($result)); @@ -94,7 +94,8 @@ sub run { my @instances = ('*'); my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd}, $result, - [{'label' => 'cpu.usage.average', 'instances' => \@instances}], + [{'label' => 'cpu.usage.average', 'instances' => \@instances}, + {'label' => 'cpu.usagemhz.average', 'instances' => \@instances}], $self->{obj_esxd}->{perfcounter_speriod}, skip_undef_counter => 1, multiples => 1, multiples_result_by_entity => 1); return if (centreon::esxd::common::performance_errors($self->{obj_esxd}, $values) == 1); @@ -111,6 +112,7 @@ sub run { multiple => $multiple) == 0); my $entity_value = $entity_view->{mo_ref}->{value}; my $total_cpu_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{obj_esxd}->{perfcounter_cache}->{'cpu.usage.average'}->{'key'} . ":"}[0] * 0.01)); + my $total_cpu_mhz_average = centreon::esxd::common::simplify_number(centreon::esxd::common::convert_number($values->{$entity_value}->{$self->{obj_esxd}->{perfcounter_cache}->{'cpu.usagemhz.average'}->{'key'} . ":"}[0])); my $exit = $self->{manager}->{perfdata}->threshold_check(value => $total_cpu_average, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]); @@ -131,6 +133,9 @@ sub run { warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning'), critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical'), min => 0, max => 100); + $self->{manager}->{output}->perfdata_add(label => 'cpu_total_MHz' . $extra_label, unit => 'MHz', + value => $total_cpu_mhz_average, + min => 0, max => $entity_view->{'summary.hardware.numCpuCores'} * $entity_view->{'summary.hardware.cpuMhz'}); foreach my $id (sort { my ($cida, $cia) = split /:/, $a; my ($cidb, $cib) = split /:/, $b; diff --git a/connectors/vmware/src/centreon/esxd/cmdcpuvm.pm b/connectors/vmware/src/centreon/esxd/cmdcpuvm.pm index 932330274..feb912d3d 100644 --- a/connectors/vmware/src/centreon/esxd/cmdcpuvm.pm +++ b/connectors/vmware/src/centreon/esxd/cmdcpuvm.pm @@ -148,7 +148,7 @@ sub run { $self->{manager}->{output}->perfdata_add(label => $entry->{perf_label} . $extra_label, unit => $entry->{perf_unit}, value => $entry->{value}, warning => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'warning_' . $entry->{label}), - critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical_in' . $entry->{label}), + critical => $self->{manager}->{perfdata}->get_perfdata_for_output(label => 'critical_' . $entry->{label}), min => $entry->{perf_min}, max => $entry->{perf_max}); }