From 20d9d48d78bbcd474ff0e992555365b1d479783e Mon Sep 17 00:00:00 2001 From: benoit Date: Wed, 23 Aug 2023 15:53:34 +0200 Subject: [PATCH] Fix the liveness check in node_is_alive Previously if a node wasn't reachable whe would get an UNKNOWN error. instead of a CRITICAL error. ``` NODEISALIVE UNKNOWN - Connection failed for all provided endpoints ``` We now get the correct error. ``` NODEISALIVE CRITICAL - This node is not alive (patroni is not running). | is_alive=0;;@0 ``` --- check_patroni/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_patroni/types.py b/check_patroni/types.py index 16789a7..2d7f3c8 100644 --- a/check_patroni/types.py +++ b/check_patroni/types.py @@ -73,7 +73,7 @@ class PatroniResource(nagiosplugin.Resource): return r.json() except requests.exceptions.JSONDecodeError: return None - raise nagiosplugin.CheckError("Connection failed for all provided endpoints") + raise APIError("Connection failed for all provided endpoints") HandleUnknown = Callable[[nagiosplugin.Summary, nagiosplugin.Results], Any]