Skip to content
Snippets Groups Projects
Commit ea947ac3 authored by David Schmitz's avatar David Schmitz
Browse files

fix/wrong_ratelimit_stats: start to work on ability for remembering value...

fix/wrong_ratelimit_stats: start to work on ability for remembering value matched offset for handling edited active rules which changes of rate-limit
parent 93f70e23
No related branches found
No related tags found
No related merge requests found
......@@ -469,15 +469,34 @@ def poll_snmp_statistics():
try:
val_matched = newdata[flowspec_params_str][xtype]
logger.info("poll_snmp_statistics(): 1b STATISTICS_PER_RULE rule_id="+str(rule_id)+" before last_matched__remember_offset_value fix: val_matched="+str(val_matched))
##
val_matched__pkts = newdata[flowspec_params_str][xtype]["packets"]
val_matched__bytes = newdata[flowspec_params_str][xtype]["bytes"]
key_remember_oldmatched = str(rule_id)+".remember_oldmatched_offset"
try:
last_matched__remember_offset_value = history_per_rule[key_remember_oldmatched]["value_matched"]
logger.info("poll_snmp_statistics(): 1b STATISTICS_PER_RULE rule_id="+str(rule_id)+" before last_matched__remember_offset_value fix: last_matched__remember_offset_value="+str(last_matched__remember_offset_value))
last_matched__remember_offset_value__pkts = last_matched__remember_offset_value["packets"]
last_matched__remember_offset_value__bytes = last_matched__remember_offset_value["bytes"]
except:
last_matched__remember_offset_value__pkts = 0
last_matched__remember_offset_value__bytes = 0
val_matched__pkts = val_matched__pkts + last_matched__remember_offset_value__pkts
val_matched__bytes = val_matched__bytes + last_matched__remember_offset_value__bytes
newdata[flowspec_params_str][xtype]["packets"] = val_matched__pkts
newdata[flowspec_params_str][xtype]["bytes"] = val_matched__bytes
logger.info("poll_snmp_statistics(): 1b STATISTICS_PER_RULE rule_id="+str(rule_id)+" after last_matched__remember_offset_value fix: val_matched="+str(val_matched))
##
except Exception:
val_matched = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment