mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 23:54:18 +02:00
+ fix illegal division for linux cpu local mode (Fix #88)
This commit is contained in:
parent
4a2f7159f5
commit
c944489064
@ -131,6 +131,12 @@ sub run {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $total_elapsed = ($datas->{'cpu_idle_' . $cpu_number} + $datas->{'cpu_user_' . $cpu_number} + $datas->{'cpu_system_' . $cpu_number} + $datas->{'cpu_iowait_' . $cpu_number}) - ($old_cpu_user + $old_cpu_idle + $old_cpu_system + $old_cpu_iowait);
|
my $total_elapsed = ($datas->{'cpu_idle_' . $cpu_number} + $datas->{'cpu_user_' . $cpu_number} + $datas->{'cpu_system_' . $cpu_number} + $datas->{'cpu_iowait_' . $cpu_number}) - ($old_cpu_user + $old_cpu_idle + $old_cpu_system + $old_cpu_iowait);
|
||||||
|
if ($total_elapsed == 0) {
|
||||||
|
$self->{output}->output_add(severity => 'OK',
|
||||||
|
short_msg => "No new values for cpu counters");
|
||||||
|
$self->{output}->display();
|
||||||
|
$self->{output}->exit();
|
||||||
|
}
|
||||||
my $idle_elapsed = $datas->{'cpu_idle_' . $cpu_number} - $old_cpu_idle;
|
my $idle_elapsed = $datas->{'cpu_idle_' . $cpu_number} - $old_cpu_idle;
|
||||||
my $cpu_ratio_usetime = 100 * $idle_elapsed / $total_elapsed;
|
my $cpu_ratio_usetime = 100 * $idle_elapsed / $total_elapsed;
|
||||||
$cpu_ratio_usetime = 100 - $cpu_ratio_usetime;
|
$cpu_ratio_usetime = 100 - $cpu_ratio_usetime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user