Update the README and help

This commit is contained in:
benoit 2022-02-07 11:03:12 +01:00
parent e663695b26
commit 7898011c40
4 changed files with 78 additions and 59 deletions

View file

@ -9,6 +9,7 @@ Options:
--config FILE Read option defaults from the specified INI file --config FILE Read option defaults from the specified INI file
[default: config.ini] [default: config.ini]
-e, --endpoints TEXT API endpoint. Can be specified multiple times. -e, --endpoints TEXT API endpoint. Can be specified multiple times.
[default: http://127.0.0.1:8008]
--cert_file TEXT File with the client certificate. --cert_file TEXT File with the client certificate.
--key_file TEXT File with the client key. --key_file TEXT File with the client key.
--ca_file TEXT The CA certificate. --ca_file TEXT The CA certificate.
@ -16,6 +17,7 @@ Options:
(debug) [x>=0] (debug) [x>=0]
--version --version
--timeout INTEGER Timeout in seconds for the API queries (0 to disable) --timeout INTEGER Timeout in seconds for the API queries (0 to disable)
[default: 2]
--help Show this message and exit. --help Show this message and exit.
Commands: Commands:
@ -32,28 +34,39 @@ Commands:
node_tl_has_changed Check if the timeline has changed. node_tl_has_changed Check if the timeline has changed.
``` ```
## install ## Install
The check requers python3. Using a virtual env is advised for testing : Installation from the git repository:
``` ```
pip -m venv ~/venv $ git clone <FIXME>
source ~venv/bin/activate
``` ```
Clone the repo, then install with pip3 from it : Change the branch if necessary. Then create a dedicated environment,
install dependencies and then check_patroni from the repo:
``` ```
pip3 install . $ cd check_patroni
pip3 install .[dev] $ python3 -m venv .venv
pip3 install .[test] $ . .venv/bin/activate
(.venv) $ pip3 install .
(.venv) $ pip3 install .[dev] # for dev purposes
(.venv) $ pip3 install .[test] # for testing purposes
(.venv) $ check_patroni
```
To quit this env and destroy it:
```
$ deactivate
$ rm -r .venv
``` ```
Links: Links:
* [pip & centos 7](https://linuxize.com/post/how-to-install-pip-on-centos-7/) * [pip & centos 7](https://linuxize.com/post/how-to-install-pip-on-centos-7/)
* [pip & debian10](https://linuxize.com/post/how-to-install-pip-on-debian-10/) * [pip & debian10](https://linuxize.com/post/how-to-install-pip-on-debian-10/)
## config file ## Config file
All global and service specific parameters can be specified via a config file has follows: All global and service specific parameters can be specified via a config file has follows:
@ -68,7 +81,7 @@ timeout = 0
[options.node_is_replica] [options.node_is_replica]
lag=100 lag=100
``` ```
## thresholds ## Thresholds
The format for the threshold parameters is "[@][start:][end]". The format for the threshold parameters is "[@][start:][end]".
@ -88,7 +101,8 @@ For example, the followinf command will raise :
check_patroni -e https://10.20.199.3:8008 cluster_has_replica --warning 2: --critical 1: check_patroni -e https://10.20.199.3:8008 cluster_has_replica --warning 2: --critical 1:
``` ```
## cluster services ## Cluster services
### cluster_config_has_changed ### cluster_config_has_changed
``` ```
@ -161,7 +175,7 @@ Options:
``` ```
Usage: check_patroni cluster_is_in_maintenance [OPTIONS] Usage: check_patroni cluster_is_in_maintenance [OPTIONS]
Check if the cluster is in maintenance mode ie paused. Check if the cluster is in maintenance mode or paused.
Check: Check:
* `OK`: If the cluster is in maintenance mode. * `OK`: If the cluster is in maintenance mode.
@ -198,7 +212,8 @@ Options:
--help Show this message and exit. --help Show this message and exit.
``` ```
## node services ## Node services
### node_is_alive ### node_is_alive
``` ```

View file

@ -345,7 +345,7 @@ def cluster_config_has_changed(
@click.pass_context @click.pass_context
@nagiosplugin.guarded @nagiosplugin.guarded
def cluster_is_in_maintenance(ctx: click.Context) -> None: def cluster_is_in_maintenance(ctx: click.Context) -> None:
"""Check if the cluster is in maintenance mode ie paused. """Check if the cluster is in maintenance mode or paused.
\b \b
Check: Check:

View file

@ -1,9 +0,0 @@
[options]
endpoints = https://10.20.199.3:8008, https://10.20.199.4:8008,https://10.20.199.5:8008
cert_file = ./ssl/benoit-dalibo-cert.pem
key_file = ./ssl/benoit-dalibo-key.pem
ca_file = ./ssl/CA-cert.pem
timeout = 0
[options.node_is_replica]
lag=100

View file

@ -23,28 +23,39 @@ cat << '_EOF_' > $README
_EOF_ _EOF_
helpme helpme
cat << '_EOF_' >> $README cat << '_EOF_' >> $README
## install ## Install
The check requers python3. Using a virtual env is advised for testing : Installation from the git repository:
``` ```
pip -m venv ~/venv $ git clone <FIXME>
source ~venv/bin/activate
``` ```
Clone the repo, then install with pip3 from it : Change the branch if necessary. Then create a dedicated environment,
install dependencies and then check_patroni from the repo:
``` ```
pip3 install . $ cd check_patroni
pip3 install .[dev] $ python3 -m venv .venv
pip3 install .[test] $ . .venv/bin/activate
(.venv) $ pip3 install .
(.venv) $ pip3 install .[dev] # for dev purposes
(.venv) $ pip3 install .[test] # for testing purposes
(.venv) $ check_patroni
```
To quit this env and destroy it:
```
$ deactivate
$ rm -r .venv
``` ```
Links: Links:
* [pip & centos 7](https://linuxize.com/post/how-to-install-pip-on-centos-7/) * [pip & centos 7](https://linuxize.com/post/how-to-install-pip-on-centos-7/)
* [pip & debian10](https://linuxize.com/post/how-to-install-pip-on-debian-10/) * [pip & debian10](https://linuxize.com/post/how-to-install-pip-on-debian-10/)
## config file ## Config file
All global and service specific parameters can be specified via a config file has follows: All global and service specific parameters can be specified via a config file has follows:
@ -59,7 +70,7 @@ timeout = 0
[options.node_is_replica] [options.node_is_replica]
lag=100 lag=100
``` ```
## thresholds ## Thresholds
The format for the threshold parameters is "[@][start:][end]". The format for the threshold parameters is "[@][start:][end]".
@ -80,7 +91,8 @@ check_patroni -e https://10.20.199.3:8008 cluster_has_replica --warning 2: --cri
``` ```
_EOF_ _EOF_
readme readme
readme "## cluster services" readme "## Cluster services"
readme
readme "### cluster_config_has_changed" readme "### cluster_config_has_changed"
helpme cluster_config_has_changed helpme cluster_config_has_changed
readme "### cluster_has_leader" readme "### cluster_has_leader"
@ -91,7 +103,8 @@ readme "### cluster_is_in_maintenance"
helpme cluster_is_in_maintenance helpme cluster_is_in_maintenance
readme "### cluster_node_count" readme "### cluster_node_count"
helpme cluster_node_count helpme cluster_node_count
readme "## node services" readme "## Node services"
readme
readme "### node_is_alive" readme "### node_is_alive"
helpme node_is_alive helpme node_is_alive
readme "### node_is_pending_restart" readme "### node_is_pending_restart"