diff --git a/README.md b/README.md index 9693273..de6d94c 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ Usage: check_patroni cluster_has_replica [OPTIONS] Check if the cluster has healthy replicas. A healthy replica: - * is in running state + * is in running or streaming state (V3.0.4) * has a replica role * has a lag lower or equal to max_lag @@ -216,7 +216,7 @@ Usage: check_patroni cluster_node_count [OPTIONS] * running custom bootstrap script, custom bootstrap failed * starting, start failed * restarting, restart failed - * running + * running, streaming (for a replica V3.0.4) * stopping, stopped, stop failed * creating replica * crashed diff --git a/check_patroni/cli.py b/check_patroni/cli.py index 30c70ca..52b4989 100644 --- a/check_patroni/cli.py +++ b/check_patroni/cli.py @@ -229,7 +229,7 @@ def cluster_node_count( * running custom bootstrap script, custom bootstrap failed * starting, start failed * restarting, restart failed - * running + * running, streaming (for a replica V3.0.4) * stopping, stopped, stop failed * creating replica * crashed @@ -322,7 +322,7 @@ def cluster_has_replica( \b A healthy replica: - * is in running state + * is in running or streaming state (V3.0.4) * has a replica role * has a lag lower or equal to max_lag diff --git a/check_patroni/cluster.py b/check_patroni/cluster.py index 62026cf..b5c1d63 100644 --- a/check_patroni/cluster.py +++ b/check_patroni/cluster.py @@ -90,7 +90,11 @@ class ClusterHasReplica(PatroniResource): for member in item_dict["members"]: # FIXME are there other acceptable states if member["role"] == "replica": - if member["state"] == "running" and member["lag"] != "unknown": + # patroni 3.0.4 changed the standby state from running to streaming + if ( + member["state"] in ["running", "streaming"] + and member["lag"] != "unknown" # noqa: W503 + ): replicas.append({"name": member["name"], "lag": member["lag"]}) if self.max_lag is None or self.max_lag >= int(member["lag"]): healthy_replica += 1