From af2507f1bfb79ccc51912db11cee276fa51fa445 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 10 Feb 2023 15:22:40 +0100 Subject: [PATCH] copr-fe: nagios -> prometheus: WARNING state == 50% --- .../frontend/files/copr-frontend-prometheus-monitoring.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/copr/frontend/files/copr-frontend-prometheus-monitoring.py b/roles/copr/frontend/files/copr-frontend-prometheus-monitoring.py index 8d99529bf7..60a30769c5 100644 --- a/roles/copr/frontend/files/copr-frontend-prometheus-monitoring.py +++ b/roles/copr/frontend/files/copr-frontend-prometheus-monitoring.py @@ -9,8 +9,7 @@ from prometheus_client import CollectorRegistry, write_to_textfile, Gauge def collect_nagios_service_state(url, name, documentation, filename): registry = CollectorRegistry() gauge = Gauge(name, documentation, registry=registry) - state = 0 - + state = 0.0 try: # Give the Nagios (our our network) some time to recover before we @@ -28,7 +27,9 @@ def collect_nagios_service_state(url, name, documentation, filename): soup = BeautifulSoup(response.content, features="lxml") if soup.select_one("div.serviceOK"): - state = 1 + state = 1.0 + elif soup.select_one("div.serviceWARNING"): + state = 0.5 except Exception: pass