vmware nethost: fix illegal division by zero

This commit is contained in:
garnier-quentin 2019-02-26 13:01:36 +01:00
parent 8bddb3d6bc
commit 98197fe8e9
1 changed files with 5 additions and 2 deletions

View File

@ -92,8 +92,11 @@ sub custom_dropped_calc {
$self->{result_values}->{dropped} = $options{new_datas}->{$self->{instance} . '_dropped_' . $options{extra_options}->{label_ref}};
$self->{result_values}->{packets} = $options{new_datas}->{$self->{instance} . '_packets_' . $options{extra_options}->{label_ref}};
$self->{result_values}->{label_ref} = $options{extra_options}->{label_ref};
$self->{result_values}->{dropped_prct} = $self->{result_values}->{dropped} * 100 / $self->{result_values}->{packets};
$self->{result_values}->{dropped_prct} = 0;
if ($self->{result_values}->{packets} > 0) {
$self->{result_values}->{dropped_prct} = $self->{result_values}->{dropped} * 100 / $self->{result_values}->{packets};
}
return 0;
}