Loading manifests/monitoringservice.yaml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,7 @@ spec: - containerPort: 9192 - containerPort: 9192 env: env: - name: LOG_LEVEL - name: LOG_LEVEL value: "INFO" value: "DEBUG" envFrom: envFrom: - secretRef: - secretRef: name: qdb-data name: qdb-data Loading my_deploy.sh +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator" export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator policy" # Set the tag you want to use for your images. # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" export TFS_IMAGE_TAG="dev" Loading Loading @@ -57,10 +57,10 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="YES" export CRDB_REDEPLOY="" # ----- NATS ------------------------------------------------------------------- # ----- NATS ------------------------------------------------------------------- Loading @@ -69,7 +69,7 @@ export CRDB_REDEPLOY="YES" export NATS_NAMESPACE="nats" export NATS_NAMESPACE="nats" # Disable flag for re-deploying NATS from scratch. # Disable flag for re-deploying NATS from scratch. export NATS_REDEPLOY="YES" export NATS_REDEPLOY="" # ----- QuestDB ---------------------------------------------------------------- # ----- QuestDB ---------------------------------------------------------------- Loading src/monitoring/service/MetricsDBTools.py +30 −29 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # See the License for the specific language governing permissions and # limitations under the License. # limitations under the License. import time import time, math from random import random from random import random from questdb.ingress import Sender, IngressError from questdb.ingress import Sender, IngressError Loading Loading @@ -264,68 +264,69 @@ class MetricsDB(): for kpi in kpi_list: for kpi in kpi_list: alarm = False alarm = False kpi_value = kpi[2] kpi_value = kpi[2] kpiMinIsNone = ((kpiMinValue is None) or math.isnan(kpiMinValue)) kpiMaxIsNone = ((kpiMaxValue is None) or math.isnan(kpiMaxValue)) LOGGER.info(kpiMinIsNone) LOGGER.info(kpiMaxIsNone) if (kpiMinValue == kpi_value and kpiMaxValue == kpi_value and inRange): if (kpiMinValue == kpi_value and kpiMaxValue == kpi_value and inRange): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and includeMaxValue): if (kpi_value >= kpiMinValue and kpi_value <= kpiMaxValue): if (kpi_value >= kpiMinValue and kpi_value <= kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and not includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and not includeMaxValue): if (kpi_value >= kpiMinValue and kpi_value < kpiMaxValue): if (kpi_value >= kpiMinValue and kpi_value < kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and includeMaxValue): if (kpi_value > kpiMinValue and kpi_value <= kpiMaxValue): if (kpi_value > kpiMinValue and kpi_value <= kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and not includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and not includeMaxValue): if (kpi_value > kpiMinValue and kpi_value < kpiMaxValue): if (kpi_value > kpiMinValue and kpi_value < kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and includeMaxValue): if (kpi_value <= kpiMinValue or kpi_value >= kpiMaxValue): if (kpi_value <= kpiMinValue or kpi_value >= kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and not includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and not includeMaxValue): if (kpi_value <= kpiMinValue or kpi_value > kpiMaxValue): if (kpi_value <= kpiMinValue or kpi_value > kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and includeMaxValue): if (kpi_value < kpiMinValue or kpi_value >= kpiMaxValue): if (kpi_value < kpiMinValue or kpi_value >= kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and not includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and not includeMaxValue): if (kpi_value < kpiMinValue or kpi_value > kpiMaxValue): if (kpi_value < kpiMinValue or kpi_value > kpiMaxValue): alarm = True alarm = True elif (inRange and kpiMinValue is not None and kpiMaxValue is None and includeMinValue): elif (inRange and not kpiMinIsNone and kpiMaxIsNone and includeMinValue): if (kpi_value >= kpiMinValue): if (kpi_value >= kpiMinValue): alarm = True alarm = True elif (inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (inRange and not kpiMinIsNone and kpiMaxIsNone and not includeMinValue): if (kpi_value > kpiMinValue): if (kpi_value > kpiMinValue): alarm = True alarm = True elif (not inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (not inRange and not kpiMinIsNone and kpiMaxIsNone and includeMinValue): if (kpi_value <= kpiMinValue): if (kpi_value <= kpiMinValue): alarm = True alarm = True elif (not inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (not inRange and not kpiMinIsNone and kpiMaxIsNone and not includeMinValue): if (kpi_value <= kpiMinValue): if (kpi_value < kpiMinValue): alarm = True alarm = True elif (inRange and kpiMinValue is None and kpiMaxValue is not None and includeMaxValue): elif (inRange and kpiMinIsNone and not kpiMaxIsNone and includeMaxValue): if (kpi_value <= kpiMaxValue): if (kpi_value <= kpiMaxValue): alarm = True alarm = True elif (inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (inRange and kpiMinIsNone and not kpiMaxIsNone and not includeMaxValue): if (kpi_value < kpiMaxValue): if (kpi_value < kpiMaxValue): alarm = True alarm = True elif (not inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (not inRange and kpiMinIsNone and not kpiMaxIsNone and includeMaxValue): if (kpi_value >= kpiMaxValue): if (kpi_value >= kpiMaxValue): alarm = True alarm = True elif (not inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (not inRange and kpiMinIsNone and not kpiMaxIsNone and not includeMaxValue): if (kpi_value >= kpiMaxValue): if (kpi_value > kpiMaxValue): alarm = True alarm = True if alarm: if alarm: valid_kpi_list.append(kpi) valid_kpi_list.append(kpi) if valid_kpi_list: alarm_queue.put_nowait(valid_kpi_list) alarm_queue.put_nowait(valid_kpi_list) LOGGER.debug(f"Alarm of KPI {kpi_id} triggered -> kpi_value:{kpi[2]}, timestamp:{kpi[1]}") LOGGER.debug(f"Alarm of KPI {kpi_id} triggered -> kpi_value:{kpi[2]}, timestamp:{kpi[1]}") else: LOGGER.debug(f"No new alarms triggered for the alarm of KPI {kpi_id}") else: else: LOGGER.debug(f"No new data for the alarm of KPI {kpi_id}") LOGGER.debug(f"No new data for the alarm of KPI {kpi_id}") except (Exception) as e: except (Exception) as e: Loading src/monitoring/service/MonitoringServiceServicerImpl.py +8 −2 Original line number Original line Diff line number Diff line Loading @@ -407,13 +407,19 @@ class MonitoringServiceServicerImpl(MonitoringServiceServicer): alarm_description = request.alarm_description alarm_description = request.alarm_description alarm_name = request.name alarm_name = request.name kpi_id = request.kpi_id.kpi_id.uuid kpi_id = request.kpi_id.kpi_id.uuid kpi_min_value = request.kpi_value_range.kpiMinValue.floatVal kpi_min_value = float(request.kpi_value_range.kpiMinValue.floatVal) kpi_max_value = request.kpi_value_range.kpiMaxValue.floatVal kpi_max_value = float(request.kpi_value_range.kpiMaxValue.floatVal) in_range = request.kpi_value_range.inRange in_range = request.kpi_value_range.inRange include_min_value = request.kpi_value_range.includeMinValue include_min_value = request.kpi_value_range.includeMinValue include_max_value = request.kpi_value_range.includeMaxValue include_max_value = request.kpi_value_range.includeMaxValue timestamp = request.timestamp.timestamp timestamp = request.timestamp.timestamp LOGGER.info(f"kpi_min_value: {kpi_min_value}") LOGGER.info(f"kpi_max_value: {kpi_max_value}") LOGGER.info(f"in_range: {in_range}") LOGGER.info(f"include_min_value: {include_min_value}") LOGGER.info(f"include_max_value: {include_max_value}") LOGGER.debug(f"request.AlarmID: {request.alarm_id.alarm_id.uuid}") LOGGER.debug(f"request.AlarmID: {request.alarm_id.alarm_id.uuid}") if request.alarm_id.alarm_id.uuid != "": if request.alarm_id.alarm_id.uuid != "": Loading src/policy/src/main/docker/Dockerfile.multistage.jvm +1 −1 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,7 @@ RUN mvn --errors --batch-mode package -Dmaven.test.skip=true # Stage 2 # Stage 2 FROM builder AS unit-test FROM builder AS unit-test RUN mvn --errors --batch-mode -Pgenerate-consolidated-coverage verify #RUN ./mvnw --errors --batch-mode -Pgenerate-consolidated-coverage verify # Stage 3 # Stage 3 FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release Loading Loading
manifests/monitoringservice.yaml +1 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,7 @@ spec: - containerPort: 9192 - containerPort: 9192 env: env: - name: LOG_LEVEL - name: LOG_LEVEL value: "INFO" value: "DEBUG" envFrom: envFrom: - secretRef: - secretRef: name: qdb-data name: qdb-data Loading
my_deploy.sh +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" export TFS_REGISTRY_IMAGES="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. # Set the list of components, separated by spaces, you want to build images for, and deploy. export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator" export TFS_COMPONENTS="context device automation monitoring pathcomp service slice compute webui load_generator policy" # Set the tag you want to use for your images. # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" export TFS_IMAGE_TAG="dev" Loading Loading @@ -57,10 +57,10 @@ export CRDB_DATABASE="tfs" export CRDB_DEPLOY_MODE="single" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="YES" export CRDB_REDEPLOY="" # ----- NATS ------------------------------------------------------------------- # ----- NATS ------------------------------------------------------------------- Loading @@ -69,7 +69,7 @@ export CRDB_REDEPLOY="YES" export NATS_NAMESPACE="nats" export NATS_NAMESPACE="nats" # Disable flag for re-deploying NATS from scratch. # Disable flag for re-deploying NATS from scratch. export NATS_REDEPLOY="YES" export NATS_REDEPLOY="" # ----- QuestDB ---------------------------------------------------------------- # ----- QuestDB ---------------------------------------------------------------- Loading
src/monitoring/service/MetricsDBTools.py +30 −29 Original line number Original line Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # See the License for the specific language governing permissions and # limitations under the License. # limitations under the License. import time import time, math from random import random from random import random from questdb.ingress import Sender, IngressError from questdb.ingress import Sender, IngressError Loading Loading @@ -264,68 +264,69 @@ class MetricsDB(): for kpi in kpi_list: for kpi in kpi_list: alarm = False alarm = False kpi_value = kpi[2] kpi_value = kpi[2] kpiMinIsNone = ((kpiMinValue is None) or math.isnan(kpiMinValue)) kpiMaxIsNone = ((kpiMaxValue is None) or math.isnan(kpiMaxValue)) LOGGER.info(kpiMinIsNone) LOGGER.info(kpiMaxIsNone) if (kpiMinValue == kpi_value and kpiMaxValue == kpi_value and inRange): if (kpiMinValue == kpi_value and kpiMaxValue == kpi_value and inRange): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and includeMaxValue): if (kpi_value >= kpiMinValue and kpi_value <= kpiMaxValue): if (kpi_value >= kpiMinValue and kpi_value <= kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and not includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and not includeMaxValue): if (kpi_value >= kpiMinValue and kpi_value < kpiMaxValue): if (kpi_value >= kpiMinValue and kpi_value < kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and includeMaxValue): if (kpi_value > kpiMinValue and kpi_value <= kpiMaxValue): if (kpi_value > kpiMinValue and kpi_value <= kpiMaxValue): alarm = True alarm = True elif ( elif (inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and not includeMaxValue): inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and not includeMaxValue): if (kpi_value > kpiMinValue and kpi_value < kpiMaxValue): if (kpi_value > kpiMinValue and kpi_value < kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and includeMaxValue): if (kpi_value <= kpiMinValue or kpi_value >= kpiMaxValue): if (kpi_value <= kpiMinValue or kpi_value >= kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and includeMinValue and not includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and includeMinValue and not includeMaxValue): if (kpi_value <= kpiMinValue or kpi_value > kpiMaxValue): if (kpi_value <= kpiMinValue or kpi_value > kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and includeMaxValue): if (kpi_value < kpiMinValue or kpi_value >= kpiMaxValue): if (kpi_value < kpiMinValue or kpi_value >= kpiMaxValue): alarm = True alarm = True elif ( elif (not inRange and not kpiMinIsNone and not kpiMaxIsNone and not includeMinValue and not includeMaxValue): not inRange and kpiMinValue is not None and kpiMaxValue is not None and not includeMinValue and not includeMaxValue): if (kpi_value < kpiMinValue or kpi_value > kpiMaxValue): if (kpi_value < kpiMinValue or kpi_value > kpiMaxValue): alarm = True alarm = True elif (inRange and kpiMinValue is not None and kpiMaxValue is None and includeMinValue): elif (inRange and not kpiMinIsNone and kpiMaxIsNone and includeMinValue): if (kpi_value >= kpiMinValue): if (kpi_value >= kpiMinValue): alarm = True alarm = True elif (inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (inRange and not kpiMinIsNone and kpiMaxIsNone and not includeMinValue): if (kpi_value > kpiMinValue): if (kpi_value > kpiMinValue): alarm = True alarm = True elif (not inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (not inRange and not kpiMinIsNone and kpiMaxIsNone and includeMinValue): if (kpi_value <= kpiMinValue): if (kpi_value <= kpiMinValue): alarm = True alarm = True elif (not inRange and kpiMinValue is not None and kpiMaxValue is None and not includeMinValue): elif (not inRange and not kpiMinIsNone and kpiMaxIsNone and not includeMinValue): if (kpi_value <= kpiMinValue): if (kpi_value < kpiMinValue): alarm = True alarm = True elif (inRange and kpiMinValue is None and kpiMaxValue is not None and includeMaxValue): elif (inRange and kpiMinIsNone and not kpiMaxIsNone and includeMaxValue): if (kpi_value <= kpiMaxValue): if (kpi_value <= kpiMaxValue): alarm = True alarm = True elif (inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (inRange and kpiMinIsNone and not kpiMaxIsNone and not includeMaxValue): if (kpi_value < kpiMaxValue): if (kpi_value < kpiMaxValue): alarm = True alarm = True elif (not inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (not inRange and kpiMinIsNone and not kpiMaxIsNone and includeMaxValue): if (kpi_value >= kpiMaxValue): if (kpi_value >= kpiMaxValue): alarm = True alarm = True elif (not inRange and kpiMinValue is None and kpiMaxValue is not None and not includeMaxValue): elif (not inRange and kpiMinIsNone and not kpiMaxIsNone and not includeMaxValue): if (kpi_value >= kpiMaxValue): if (kpi_value > kpiMaxValue): alarm = True alarm = True if alarm: if alarm: valid_kpi_list.append(kpi) valid_kpi_list.append(kpi) if valid_kpi_list: alarm_queue.put_nowait(valid_kpi_list) alarm_queue.put_nowait(valid_kpi_list) LOGGER.debug(f"Alarm of KPI {kpi_id} triggered -> kpi_value:{kpi[2]}, timestamp:{kpi[1]}") LOGGER.debug(f"Alarm of KPI {kpi_id} triggered -> kpi_value:{kpi[2]}, timestamp:{kpi[1]}") else: LOGGER.debug(f"No new alarms triggered for the alarm of KPI {kpi_id}") else: else: LOGGER.debug(f"No new data for the alarm of KPI {kpi_id}") LOGGER.debug(f"No new data for the alarm of KPI {kpi_id}") except (Exception) as e: except (Exception) as e: Loading
src/monitoring/service/MonitoringServiceServicerImpl.py +8 −2 Original line number Original line Diff line number Diff line Loading @@ -407,13 +407,19 @@ class MonitoringServiceServicerImpl(MonitoringServiceServicer): alarm_description = request.alarm_description alarm_description = request.alarm_description alarm_name = request.name alarm_name = request.name kpi_id = request.kpi_id.kpi_id.uuid kpi_id = request.kpi_id.kpi_id.uuid kpi_min_value = request.kpi_value_range.kpiMinValue.floatVal kpi_min_value = float(request.kpi_value_range.kpiMinValue.floatVal) kpi_max_value = request.kpi_value_range.kpiMaxValue.floatVal kpi_max_value = float(request.kpi_value_range.kpiMaxValue.floatVal) in_range = request.kpi_value_range.inRange in_range = request.kpi_value_range.inRange include_min_value = request.kpi_value_range.includeMinValue include_min_value = request.kpi_value_range.includeMinValue include_max_value = request.kpi_value_range.includeMaxValue include_max_value = request.kpi_value_range.includeMaxValue timestamp = request.timestamp.timestamp timestamp = request.timestamp.timestamp LOGGER.info(f"kpi_min_value: {kpi_min_value}") LOGGER.info(f"kpi_max_value: {kpi_max_value}") LOGGER.info(f"in_range: {in_range}") LOGGER.info(f"include_min_value: {include_min_value}") LOGGER.info(f"include_max_value: {include_max_value}") LOGGER.debug(f"request.AlarmID: {request.alarm_id.alarm_id.uuid}") LOGGER.debug(f"request.AlarmID: {request.alarm_id.alarm_id.uuid}") if request.alarm_id.alarm_id.uuid != "": if request.alarm_id.alarm_id.uuid != "": Loading
src/policy/src/main/docker/Dockerfile.multistage.jvm +1 −1 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,7 @@ RUN mvn --errors --batch-mode package -Dmaven.test.skip=true # Stage 2 # Stage 2 FROM builder AS unit-test FROM builder AS unit-test RUN mvn --errors --batch-mode -Pgenerate-consolidated-coverage verify #RUN ./mvnw --errors --batch-mode -Pgenerate-consolidated-coverage verify # Stage 3 # Stage 3 FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 AS release Loading