From c287b2f65037cc3d2973af5b7d8ee6757103f506 Mon Sep 17 00:00:00 2001 From: pfamelis Date: Tue, 28 Mar 2023 15:28:35 +0300 Subject: [PATCH] fix: add condition to check before raising alarm --- src/monitoring/service/MonitoringServiceServicerImpl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/monitoring/service/MonitoringServiceServicerImpl.py b/src/monitoring/service/MonitoringServiceServicerImpl.py index f408734df..e5fc4c81f 100644 --- a/src/monitoring/service/MonitoringServiceServicerImpl.py +++ b/src/monitoring/service/MonitoringServiceServicerImpl.py @@ -531,7 +531,9 @@ class MonitoringServiceServicerImpl(MonitoringServiceServicer): kpi.kpi_id.kpi_id.uuid = str(item[0]) kpi.timestamp.timestamp = timestamp_string_to_float(item[1]) kpi.kpi_value.floatVal = item[2] # This must be improved - alarm_response.kpi_list.kpi.append(kpi) + # The following condition needs to be improved to take into account all cases + if (kpi.kpi_value.floatVal > kpiMinValue) or (kpi.kpi_value.floatVal < kpiMaxValue): + alarm_response.kpi_list.kpi.append(kpi) alarm_response.alarm_id.alarm_id.uuid = alarm_id yield alarm_response if timestamp_utcnow_to_float() > end_timestamp: -- GitLab