X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fserver%2Fservice.py;h=7bc6dfc9c78d75289aa6db3164ed6f4197bebf52;hb=refs%2Fchanges%2F16%2F14316%2F1;hp=94bdf4e912cdf2c6756be4631736df334bb11c47;hpb=088fbd3cc60029c62ae83a44f39f907890f832c7;p=osm%2FMON.git diff --git a/osm_mon/server/service.py b/osm_mon/server/service.py index 94bdf4e..7bc6dfc 100755 --- a/osm_mon/server/service.py +++ b/osm_mon/server/service.py @@ -41,11 +41,12 @@ class ServerService: severity: str, statistic: str, metric_name: str, + action: str, tags: dict, ) -> Alarm: log.debug("create_alarm") alarm = Alarm( - name, severity, threshold, operation, statistic, metric_name, tags + name, severity, threshold, operation, statistic, metric_name, action, tags ) self.common_db.create_alarm(alarm) log.info("Alarm %s created", alarm.name) @@ -59,17 +60,12 @@ class ServerService: def populate_prometheus(self): # This method can be executed infinite number of times # without side-effects. - self.common_db.common_db.set_one( - "prometheus_jobs", {"job_name": "mon_exporter"}, { - "job_name": "mon_exporter", - "static_configs": [ - { - "targets": [ - "mon:8000" - ] - } - ] - }, + log.info("Setting up MON Exporter in prometheus") + result = self.common_db.common_db.set_one( + "prometheus_jobs", + {"job_name": "mon_exporter"}, + {"job_name": "mon_exporter", "static_configs": [{"targets": ["mon:8000"]}]}, fail_on_empty=False, - upsert=True + upsert=True, ) + log.info("Prometheus Jobs added > {}".format(result))