aboutsummaryrefslogtreecommitdiff
path: root/examples/py-semantic-validation
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-12-15 09:16:28 +0100
committerToni Uhlig <matzeton@googlemail.com>2023-12-15 09:16:28 +0100
commit8acf2d72737545b966df6b078043557d50d7ffee (patch)
treec8c3ee0440af1d74b84e3d41befe7009b32f329e /examples/py-semantic-validation
parent71d933b0cd9b03cf3b8acf659c8b4b564ba9431d (diff)
Improved InfluxDB push daemon.
* added proper gauge handling that enables pushing data w/o missing out anything e.g. short flows with a lifetime in-between two InfluxDB intervals Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-semantic-validation')
-rwxr-xr-xexamples/py-semantic-validation/py-semantic-validation.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/py-semantic-validation/py-semantic-validation.py b/examples/py-semantic-validation/py-semantic-validation.py
index 6da56ee26..9207c3b69 100755
--- a/examples/py-semantic-validation/py-semantic-validation.py
+++ b/examples/py-semantic-validation/py-semantic-validation.py
@@ -257,8 +257,20 @@ def onJsonLineRecvd(json_dict, instance, current_flow, global_user_data):
pass
try:
+ if current_flow.flow_finished == True and \
+ json_dict['flow_event_name'] == 'detection-update':
+ raise SemanticValidationException(current_flow,
+ 'Flow state already finished, but another detection-update received.')
+ except AttributeError:
+ pass
+
+ try:
if json_dict['flow_state'] == 'finished':
current_flow.flow_finished = True
+ elif json_dict['flow_state'] == 'info' and \
+ current_flow.flow_finished is True:
+ raise SemanticValidationException(current_flow,
+ 'Flow state already finished, but switched back to info state.')
if current_flow.flow_finished == True and \
json_dict['flow_event_name'] != 'analyse' and \