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
```
This commit is contained in:
benoit 2023-08-23 15:53:34 +02:00 committed by Benoit
parent 46dd431775
commit 20d9d48d78

View file

@ -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]