+ Fix division by zero
This commit is contained in:
parent
132d0c875e
commit
e8cdfef72f
|
@ -82,6 +82,10 @@ sub custom_utils_calc {
|
||||||
my $diff_busy = $options{new_datas}->{$self->{instance} . '_busy_ticks'} - $options{old_datas}->{$self->{instance} . '_busy_ticks'};
|
my $diff_busy = $options{new_datas}->{$self->{instance} . '_busy_ticks'} - $options{old_datas}->{$self->{instance} . '_busy_ticks'};
|
||||||
my $diff_idle = $options{new_datas}->{$self->{instance} . '_idle_ticks'} - $options{old_datas}->{$self->{instance} . '_idle_ticks'};
|
my $diff_idle = $options{new_datas}->{$self->{instance} . '_idle_ticks'} - $options{old_datas}->{$self->{instance} . '_idle_ticks'};
|
||||||
|
|
||||||
|
if (($diff_busy + $diff_idle) == 0) {
|
||||||
|
$self->{error_msg} = "wait new values";
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
$self->{result_values}->{utils} = $diff_busy * 100 / ($diff_busy + $diff_idle);
|
$self->{result_values}->{utils} = $diff_busy * 100 / ($diff_busy + $diff_idle);
|
||||||
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
$self->{result_values}->{display} = $options{new_datas}->{$self->{instance} . '_display'};
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue