diff --git a/README.md b/README.md index 17aaf00..a373fb2 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ Usage: check_patroni cluster_has_replica [OPTIONS] A healthy replica: * is in running or streaming state (V3.0.4) - * has a replica role + * has a replica or sync_standby role * has a lag lower or equal to max_lag Check: diff --git a/check_patroni/cli.py b/check_patroni/cli.py index f7e0cae..db3b6d9 100644 --- a/check_patroni/cli.py +++ b/check_patroni/cli.py @@ -324,7 +324,7 @@ def cluster_has_replica( \b A healthy replica: * is in running or streaming state (V3.0.4) - * has a replica role + * has a replica or sync_standby role * has a lag lower or equal to max_lag \b diff --git a/check_patroni/cluster.py b/check_patroni/cluster.py index 55e9bdc..26fa4d8 100644 --- a/check_patroni/cluster.py +++ b/check_patroni/cluster.py @@ -91,7 +91,7 @@ class ClusterHasReplica(PatroniResource): unhealthy_replica = 0 for member in item_dict["members"]: # FIXME are there other acceptable states - if member["role"] == "replica": + if member["role"] in ["replica", "sync_standby"]: # patroni 3.0.4 changed the standby state from running to streaming if ( member["state"] in ["running", "streaming"] diff --git a/tests/json/cluster_has_replica_ok.json b/tests/json/cluster_has_replica_ok.json index 547d6c8..a74fcd2 100644 --- a/tests/json/cluster_has_replica_ok.json +++ b/tests/json/cluster_has_replica_ok.json @@ -21,7 +21,7 @@ }, { "name": "srv3", - "role": "replica", + "role": "sync_standby", "state": "running", "api_url": "https://10.20.199.5:8008/patroni", "host": "10.20.199.5",