Fix #4863
git-svn-id: http://svn.merethis.net/centreon-esxd/trunk@51 a5eaa968-4c79-4d68-970d-af6011b5b055
This commit is contained in:
parent
232eff04dc
commit
967d577d8b
|
@ -59,7 +59,7 @@ sub cpuhost_do {
|
|||
$status |= $MYERRORS_MASK{'CRITICAL'};
|
||||
}
|
||||
|
||||
$output = "Total Average CPU usage '$total_cpu_average%' on last " . ($perfcounter_speriod / 60) . "min | cpu_total=$total_cpu_average%;$warn;$crit;0;100";
|
||||
$output = "Total Average CPU usage '$total_cpu_average%' on last " . int($perfcounter_speriod / 60) . "min | cpu_total=$total_cpu_average%;$warn;$crit;0;100";
|
||||
|
||||
foreach my $id (sort { my ($cida, $cia) = split /:/, $a;
|
||||
my ($cidb, $cib) = split /:/, $b;
|
||||
|
|
|
@ -61,7 +61,7 @@ sub cpuvm_do {
|
|||
$status |= $MYERRORS_MASK{'CRITICAL'};
|
||||
}
|
||||
|
||||
$output = "Total Average CPU usage '$total_cpu_average%', Total Average CPU '" . $total_cpu_mhz_average . "MHz' on last " . ($perfcounter_speriod / 60) . "min | cpu_total=$total_cpu_average%;$warn;$crit;0;100 cpu_total_MHz=" . $total_cpu_mhz_average . "MHz";
|
||||
$output = "Total Average CPU usage '$total_cpu_average%', Total Average CPU '" . $total_cpu_mhz_average . "MHz' on last " . int($perfcounter_speriod / 60) . "min | cpu_total=$total_cpu_average%;$warn;$crit;0;100 cpu_total_MHz=" . $total_cpu_mhz_average . "MHz";
|
||||
|
||||
foreach my $id (sort { my ($cida, $cia) = split /:/, $a;
|
||||
my ($cidb, $cib) = split /:/, $b;
|
||||
|
|
|
@ -116,16 +116,25 @@ sub generic_performance_values_historic {
|
|||
eval {
|
||||
my @perf_metric_ids = get_perf_metric_ids($perfs);
|
||||
|
||||
my $perf_query_spec;
|
||||
if ($interval == 20) {
|
||||
$perf_query_spec = PerfQuerySpec->new(entity => $view,
|
||||
metricId => @perf_metric_ids,
|
||||
format => 'normal',
|
||||
intervalId => 20,
|
||||
maxSample => 1);
|
||||
} else {
|
||||
my (@t) = gmtime(time() - $interval);
|
||||
my $start = sprintf("%04d-%02d-%02dT%02d:%02d:00Z",
|
||||
(1900+$t[5]),(1+$t[4]),$t[3],$t[2],$t[1]);
|
||||
my $perf_query_spec = PerfQuerySpec->new(entity => $view,
|
||||
$perf_query_spec = PerfQuerySpec->new(entity => $view,
|
||||
metricId => @perf_metric_ids,
|
||||
format => 'normal',
|
||||
intervalId => $interval,
|
||||
startTime => $start
|
||||
);
|
||||
#maxSample => 1);
|
||||
}
|
||||
my $perfdata = $perfmanager_view->QueryPerf(querySpec => $perf_query_spec);
|
||||
foreach (@{$$perfdata[0]->value}) {
|
||||
$results{$_->id->counterId . ":" . (defined($_->id->instance) ? $_->id->instance : "")} = $_->value;
|
||||
|
@ -154,6 +163,11 @@ sub cache_perf_counters {
|
|||
$perfcounter_speriod = $_->samplingPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
# Put refresh = 20 (for ESX check)
|
||||
if ($perfcounter_speriod == -1) {
|
||||
$perfcounter_speriod = 20;
|
||||
}
|
||||
};
|
||||
if ($@) {
|
||||
writeLogFile(LOG_ESXD_ERROR, "'$whoaim' $@");
|
||||
|
|
Loading…
Reference in New Issue