add per_minute for counters

This commit is contained in:
garnier-quentin 2020-05-20 09:09:22 +02:00 committed by Lotfi zaouche
parent d21b8a384a
commit f02c41061c
1 changed files with 5 additions and 3 deletions

View File

@ -87,10 +87,12 @@ sub calc {
# manage only one value ;)
foreach my $value (@{$self->{key_values}}) {
if (defined($value->{per_second}) && $value->{per_second} == 1) {
$self->{result_values}->{$value->{name}} = ($options{new_datas}->{$self->{instance} . '_' . $value->{name}} - $options{old_datas}->{$self->{instance} . '_' . $value->{name}}) / $options{delta_time};
} elsif (defined($value->{diff}) && $value->{diff} == 1) {
if (defined($value->{diff}) && $value->{diff} == 1) {
$self->{result_values}->{$value->{name}} = $options{new_datas}->{$self->{instance} . '_' . $value->{name}} - $options{old_datas}->{$self->{instance} . '_' . $value->{name}};
} elsif (defined($value->{per_second}) && $value->{per_second} == 1) {
$self->{result_values}->{$value->{name}} = ($options{new_datas}->{$self->{instance} . '_' . $value->{name}} - $options{old_datas}->{$self->{instance} . '_' . $value->{name}}) / $options{delta_time};
} elsif (defined($value->{per_minute}) && $value->{per_minute} == 1) {
$self->{result_values}->{$value->{name}} = ($options{new_datas}->{$self->{instance} . '_' . $value->{name}} - $options{old_datas}->{$self->{instance} . '_' . $value->{name}}) / ($options{delta_time} / 60);
} else {
$self->{result_values}->{$value->{name}} = $options{new_datas}->{$self->{instance} . '_' . $value->{name}};
}