Skip to content
Snippets Groups Projects
Commit 93f70e23 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 2e3898a7
Branches
No related tags found
No related merge requests found
......@@ -460,14 +460,29 @@ def poll_snmp_statistics():
counter = {"ts": nowstr, "value": val_dropped}
else:
logger.info("poll_snmp_statistics(): 1b STATISTICS_PER_RULE rule_id="+str(rule_id))
try:
val_dropped = newdata[flowspec_params_str][xtype_default]
except Exception:
val_dropped = 1
try:
val_matched = newdata[flowspec_params_str][xtype]
key_remember_oldmatched = str(rule_id)+".remember_oldmatched_offset"
try:
last_matched__remember_offset_value = history_per_rule[key_remember_oldmatched]["value_matched"]
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
except Exception:
val_matched = 1
##
counter = { "ts": nowstr, "value": val_dropped, "value_matched": val_matched }
counter_is_null = False
......@@ -647,8 +662,8 @@ def remember_oldmatched__for_changed_ratelimitrules_whileactive(rule_id, route_o
try:
last_matched__measurement_value = history_per_rule[key_last_measurement]["value_matched"]
last_matched__measurement_value__pkts = last_matched__measurement_value__pkts["packets"]
last_matched__measurement_value__bytes = last_matched__measurement_value__pkts["bytes"]
last_matched__measurement_value__pkts = last_matched__measurement_value["packets"]
last_matched__measurement_value__bytes = last_matched__measurement_value["bytes"]
except:
last_matched__measurement_value__pkts = 0
last_matched__measurement_value__bytes = 0
......
......@@ -488,7 +488,7 @@ def snmp_add_initial_zero_value(routepk, route_id, add_initial_value=True, zero_
try:
logger.info("snmp_add_initial_zero_value(): (3) routepk="+str(routepk)+" route_id="+str(route_id)+" add_initial_value="+str(add_initial_value)+" zero_or_null="+str(zero_or_null)+" reset_remember_last_value="+str(reset_remember_last_value)+" update_remember_last_value="+str(update_remember_last_value))
snmpstats.remember_oldmatched__for_changed_ratelimitrules_whileactive(route_id, route)
logger.debug("snmp_add_initial_zero_value(): routepk="+str(routepk)+","+str(zero_or_null)+" remember_oldmatched__for_changed_ratelimitrules_whileactive sucesss")
logger.info("snmp_add_initial_zero_value(): (4) routepk="+str(routepk)+","+str(zero_or_null)+" remember_oldmatched__for_changed_ratelimitrules_whileactive sucesss")
except Exception as e:
logger.error("snmp_add_initial_zero_value(): routepk="+str(routepk)+","+str(zero_or_null)+" remember_oldmatched__for_changed_ratelimitrules_whileactive failed: "+str(e))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment