2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

plugin xen_cpu_v2: prevent "divide by zero"

Closes: #475
This commit is contained in:
Lars Kruse 2018-03-30 04:10:14 +02:00
parent e7eb28869c
commit 2b66ed321e

View File

@ -171,8 +171,12 @@ while (($key, $value) = each %dom)
# Calc a percentage based on the _total_ available CPU time
$tmp = 0;
if ($tcpuavail != 0) {
$tmp = ( $dom{$key}->{'diff'} / $tcpuavail ) * 100;
$dom{$key}->{'pc_tcpu'} = sprintf("%.2f", $tmp);
} else {
$dom{$key}->{'pc_tcpu'} = "U";
}
if ( $debug )
{