Skip to content

Commit 104fceb

Browse files
committed
Update documentation for node_is_alive
If patroni is not running, we cannot know it's down or if the provided api url is wrong. Therefore, we return UNKNOWN. The doc and code was updated to make this more clear.
1 parent bfcfc07 commit 104fceb

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change log
22

3+
## unreleased
4+
5+
### Fixed
6+
7+
* Update the documentation to clarify that if patroni cannot be reached, we consider
8+
it's a configuration error that returns UNKNOWN (#77, reported by @MLyssens)
9+
310
## check_patroni 2.1.0 - 2024-10-19
411

512
### Fixed

README.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ example only Bash versions older than 4.4 are supported.
140140

141141
[click]: https://click.palletsprojects.com/en/8.1.x/shell-completion/
142142

143+
## Connection errors and service status
144+
145+
If patroni is not running, we have no way to know if the provided endpoint is
146+
valid, therefore the check returns UNKNOWN.
147+
143148
## Cluster services
144149

145150
### cluster_config_has_changed
@@ -356,11 +361,14 @@ Options:
356361
Usage: check_patroni node_is_alive [OPTIONS]
357362
358363
Check if the node is alive ie patroni is running. This is a liveness check
359-
as defined in Patroni's documentation.
364+
as defined in Patroni's documentation. If patroni is not running, we have no
365+
way to know if the provided endpoint is valid, therefore the check returns
366+
UNKNOWN.
360367
361368
Check:
362-
* `OK`: If patroni is running.
363-
* `CRITICAL`: otherwise.
369+
* `OK`: If patroni the liveness check returns with HTTP status 200.
370+
* `CRITICAL`: if partoni's liveness check returns with an HTTP status
371+
other than 200.
364372
365373
Perfdata:
366374
* `is_running` is 1 if patroni is running, 0 otherwise

check_patroni/cli.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -789,12 +789,15 @@ def node_patroni_version(ctx: click.Context, patroni_version: str) -> None:
789789
@nagiosplugin.guarded
790790
def node_is_alive(ctx: click.Context) -> None:
791791
"""Check if the node is alive ie patroni is running. This is
792-
a liveness check as defined in Patroni's documentation.
792+
a liveness check as defined in Patroni's documentation. If
793+
patroni is not running, we have no way to know if the provided
794+
endpoint is valid, therefore the check returns UNKNOWN.
793795
794796
\b
795797
Check:
796-
* `OK`: If patroni is running.
797-
* `CRITICAL`: otherwise.
798+
* `OK`: If patroni the liveness check returns with HTTP status 200.
799+
* `CRITICAL`: if partoni's liveness check returns with an HTTP status
800+
other than 200.
798801
799802
\b
800803
Perfdata:

check_patroni/types.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212

1313
class APIError(requests.exceptions.RequestException):
14-
"""This exception is raised when the rest api couldn't
15-
be reached and we got a http status code different from 200.
14+
"""This exception is raised when the rest api could
15+
be reached but we got a http status code different from 200.
1616
"""
1717

1818

docs/make_readme.sh

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ Please note that shell completion is not supported far all shell versions, for
121121
example only Bash versions older than 4.4 are supported.
122122
123123
[click]: https://click.palletsprojects.com/en/8.1.x/shell-completion/
124+
125+
## Connection errors and service status
126+
127+
If patroni is not running, we have no way to know if the provided endpoint is
128+
valid, therefore the check returns UNKNOWN.
124129
_EOF_
125130
readme
126131
readme "## Cluster services"

0 commit comments

Comments
 (0)