Skip to content

Commit 85b0878

Browse files
author
Anze
committed
Cleanup: counters are always ints
1 parent 9aaeb74 commit 85b0878

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

snmpcollector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _get_previous_counter_value(counter_ident):
3535
prev_value = r.hgetall(counter_ident)
3636
if not prev_value: # empty dict
3737
return None, None
38-
return int(float(prev_value[b'v'])), float(prev_value[b't'])
38+
return int(prev_value[b'v']), float(prev_value[b't'])
3939

4040

4141
def _save_current_counter_value(new_value, now, counter_ident):
@@ -54,7 +54,7 @@ def _convert_counters_to_values(results, now, counter_ident_prefix):
5454
# counter - deal with it:
5555
counter_ident = counter_ident_prefix + f'/{i}/{v.oid}/{v.oid_index}'
5656
old_value, t = _get_previous_counter_value(counter_ident)
57-
new_value = float(v.value)
57+
new_value = int(v.value)
5858
_save_current_counter_value(new_value, now, counter_ident)
5959
if old_value is None:
6060
new_results.append(SNMPVariable(oid=v.oid, oid_index=v.oid_index, value=None, snmp_type='COUNTER_PER_S'))

0 commit comments

Comments
 (0)