From b1bd44bca31367322db776969420a70c67919590 Mon Sep 17 00:00:00 2001 From: Idriss Neumann Date: Tue, 24 Dec 2024 11:21:55 +0100 Subject: [PATCH] Add level setting --- .gitignore | 2 ++ README.md | 1 + VERSION | 2 +- src/utils/monitor.py | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f2a1287..d2a395a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ __pycache__ *.iml .idea +imalive.yml + # Eclipse Core .project diff --git a/README.md b/README.md index 5314f5d..39925e7 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,7 @@ monitors: timeout: 30 # optional (30 seconds if not present) username: changeit # optional (no basic auth if not present) password: changeit # optional (no basic auth if not present) + level: INFO # optional, log level if monitor is healthy (DEBUG by default) headers: # optional (no headers if empty) - name: Accept value: application/json diff --git a/VERSION b/VERSION index 029696b..805226c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.18 +4.0.19 diff --git a/src/utils/monitor.py b/src/utils/monitor.py index c9dde63..f3ca23d 100644 --- a/src/utils/monitor.py +++ b/src/utils/monitor.py @@ -53,6 +53,7 @@ def check_http_monitor(monitor, gauges): expected_contain = get_or_else(monitor, 'expected_contain', None) body = get_or_else(monitor, 'body', None) check_tls = is_true(get_or_else(monitor, 'check_tls', True)) + level = get_or_else(monitor, 'level', 'DEBUG') duration = None auth = None headers = {} @@ -118,7 +119,7 @@ def check_http_monitor(monitor, gauges): return set_gauge(gauges['result'], 1, {**labels, 'kind': 'result'}) - log_msg("DEBUG", { + log_msg(level, { "status": "ok", "type": "monitor", "time": vdate.isoformat(),