Commit graph

43 commits

Author SHA1 Message Date
benoit a4ed20210c Improve doc for node_is_replica
node_is_replica is using the following Patroni endpoints: replica, asynchronous
and synchronous. The first two implement the lag tag. For these endpoints
the state of a replica node doesn't reflect the replication state
(streaming or in archive recovery), we only know if it's running. The
timeline is also not checked.

Therefore, if a cluster is using asynchronous replication, it is recommended
to check for the lag to detect a divegence as soon as possible.
2024-02-26 16:02:53 +01:00
benoit 78ef0f6ada Fix cluster_node_count's management of replication states
The service now supports the `streaming` state.

Since we dont check for lag or timeline in this service, a healthy node
is :

* leader : in a running state
* standby_leader : running (pre Patroni 3.0.4), streaming otherwise
* standby & sync_standby : running (pre Patroni 3.0.4), streaming otherwise

Updated the tests for this service.
2024-01-09 06:50:00 +01:00
benoit 46db3e2d15 Fix the cluster_has_leader service for standby clusters
Before this patch we checked the expected standby leader state
was `running` for all versions of Patroni.

With this patch, for:
* Patroni < 3.0.4, standby leaders are in `running` state.
* Patroni >= 3.0.4, standby leaders can be in `streaming` or `in
archive recovey` state. We will raise a warning for the latter.

The tests where modified to account for this.

Co-authored-by: Denis Laxalde <denis@laxalde.org>
2023-12-18 13:17:37 +01:00
benoit ffc330f96e Mention that shell completion support is dependant on the shell version 2023-11-16 13:59:06 +01:00
benoit 8d6b8502b6 cluster_has_replica: fix the way a healthy replica is detected
For patroni >= version 3.0.4:
* the role is `replica` or `sync_standby`
* the state is `streaming` or `in archive recovery`
* the timeline is the same as the leader
* the lag is lower or equal to `max_lag`

For prio versions of patroni:
* the role is `replica` or `sync_standby`
* the state is `running`
* the timeline is the same as the leader
* the lag is lower or equal to `max_lag`

Additionnally, we now display the timeline in the perfstats. We also try
to display the perf stats of unhealthy replica as much as possible.

Update tests for cluster_has_replica:
* Fix the tests to make them work with the new algotithm
* Add a specific test for tl divergences
2023-11-11 10:50:35 +01:00
Denis Laxalde a0189ebba7 Fix some typos spotted by codespell 2.2.6 2023-10-03 09:53:53 +02:00
benoit 82e0af8a9e Update README CONTRIBUTING RELEASE
* README: add information pertaining to shell completion;
* CONTRIBUTING: remove release information;
* RELEASE: create a dedicated file with all the relevant release
  information.
2023-08-30 10:19:18 +02:00
benoit f0c2a243f0 Moving things around in README.md and CONTRIBUTING.md 2023-08-28 11:59:59 +02:00
benoit ee3837fab1 Add info and options about sync standby to cluster_has_replica
* Add `--sync-warning` and `--sync-critical`
* Add `sync_replica` to track the number of sync replica in the perf data
* Add `MEMBER-sync` to track if a member is a sync replica in the perf data
2023-08-24 17:34:08 +02:00
benoit fd801efa38 Revert_d39122d (move packaging to pyproject.toml)
This changes requiered python 3.7 which I overlooked at first. I would
like to be able to install the check any patroni server and Patroni
supports python 3.6.
2023-08-24 16:23:55 +02:00
benoit 94a1388d06 Update changelog for cluster_has_scheduled_action 2023-08-23 18:35:06 +02:00
benoit 259f04587b Add a node_is_leader service to check for the leader states
It's possible to check for any kind of leader of specifically for a
standby leader.
2023-08-23 18:22:49 +02:00
benoit 8883d6bdc4 Add standby-leader as a valid leader type for cluster_has_leader 2023-08-23 18:22:49 +02:00
benoit 2bcddf9f87 Add a --is-sync and --is-async to node_is_replica 2023-08-23 15:41:15 +02:00
benoit 7f6a03a3cc README 2023-08-23 10:53:09 +02:00
benoit d99faeba15 Add tests for the output of the script and support pre/post 3.0.4
* Change all replica status from `running` to `streaming`
* Add an option to pytest to change the state back to `running`
* Also tests the output of the script
* Add a quick test script for live clusters
2023-08-23 10:53:09 +02:00
benoit a01a535680 Add sync_standby as an acceptable state for a replica 2023-08-21 13:11:08 +02:00
benoit 021b572e53 Redefining cluster_node_count using Patroni 3.0.4's new status indicators
Previously, replica nodes were labeled with a `running` state. As a
result, our checks were based on nodes marked as `running` through
the `--running-[warning|critical]` options.

However, with the recent changes in Patroni 3.0.4, replica nodes now
carry a `streaming` state. This shift in terminology calls for an
adjustment in our approach. A new state, `healthy_member`, has been
introduced to encompass both `running` and `streaming` nodes.

Key Modifications:

* The existing `--running-[warning|critical]` option is now designated
  as `--healthy-[warning|critical]`.
* Introduction of the `healthy_member` perfdata, which serves as the
  reference point for the aforementioned options.
* Updates to documentation, help messages, and tests.
2023-08-21 11:59:55 +02:00
benoit 2f250e846e State change in patroni 3.0.4
Since patroni 3.0.4, standby node nominal state is "streaming" instead
of "running". Some services need to be changed to account for that.

Reported in issue #28
2023-08-21 11:59:55 +02:00
benoit 050f9c6247 Fix code tag in README 2023-03-20 12:54:48 +01:00
benoit 7eea4c94be Reorganise for the urllib3 > requests change 2023-03-20 12:25:32 +01:00
benoit 9cd80f5af8 Move from urllib3 to requests 2023-03-20 12:25:32 +01:00
benoit 0800fc72e9 Add more info on states and roles for cluster_node_count 2023-03-10 10:16:01 +01:00
benoit 6f45618e08 Update node_is_alive to metion that it's an liveness check. 2023-03-10 10:16:01 +01:00
benoit 7286638121 -e/endpoints spec update
* it is now possible to specify a comma separated list of endpoints
* the documentation as been updated to explain that:
  + for node services if several addresses are specified they should
    point to different interfaces on the same server.
  + for cluster services several addresses should be used because we
    want the cluster status so the more API we try the better our chance
    of having a reply.
2023-03-10 10:16:01 +01:00
benoit 48d2656ec7 Update check_patroni's description to mention Patroni's API 2023-03-10 10:16:01 +01:00
benoit 908669f073 Add a --save option when state files are used
The checks `cluster_config_has_changed` and `node_tl_has_changed` use a
state file to store the previous value of the config hash and the
timeline.

Previously the check would fail if something changed, but the new value
would be saved directly. This behavious has changed. The new value
is saved only if `--save` is passed to the check.

The mimics the way [check_pgactivity] manages this kind of checks.

[check_pgactivity]: https://github.com/OPMDG/check_pgactivity
2023-03-02 17:32:18 +01:00
Étienne BERSAC 3ac8570748
Review README, extracting CONTRIBUTING 2022-07-11 12:12:55 +02:00
benoit 14c7ae5267 Fix README.md 2022-07-11 08:57:14 +02:00
benoit 4de20fefdc Node and Cluster services reviews 2022-02-07 14:18:14 +01:00
benoit ec3b8f6806 Update setup.py and url in README 2022-02-07 11:09:46 +01:00
benoit 7898011c40 Update the README and help 2022-02-07 11:03:12 +01:00
benoit e663695b26 Update README with some test info 2021-12-31 16:17:21 +01:00
benoit 561c3ed9da Fix doc layout and threshold doc 2021-12-31 11:30:17 +01:00
benoit 86f8bdb395 Readme: perfdata for not_tl_has_changed 2021-12-08 17:23:56 +01:00
benoit df58901fd9 Typo Readme 2021-12-08 17:14:38 +01:00
benoit ba1f5ab3e7 Syntax of threshold parameter in README.md 2021-08-26 15:31:47 +02:00
benoit 7258d5fd60 Try to fix install
* add info in README.md
* add wheel as a dependency for debian 10
2021-08-13 14:43:07 +02:00
benoit fdda1d309b Update README.md with install notes 2021-08-13 12:12:08 +02:00
benoit e0500ed3a7 Update README to mention config files 2021-08-13 11:13:33 +02:00
benoit d4e974da51 --max-lag additions and fixups
* add --max-lag to cluster_has_replica
* change --lag to --max-lag in node_is_replica
* update tests
* update README.md
2021-08-13 11:00:43 +02:00
benoit 4169766a2f Readme
* Add the README.md
* A way to generate the README.md from the help
2021-08-12 13:15:10 +02:00
benoit 1e6adc6a1a First working version 2021-08-12 13:07:10 +02:00