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
[default: config.ini]
-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.
--key_file TEXT File with the client key.
--ca_file TEXT The CA certificate.
@ -16,6 +17,7 @@ Options:
(debug) [x>=0]
--version
--timeout INTEGER Timeout in seconds for the API queries (0 to disable)
[default: 2]
--help Show this message and exit.
Commands:
@ -32,28 +34,39 @@ Commands:
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
source ~venv/bin/activate
$ git clone <FIXME>
```
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 .
pip3 install .[dev]
pip3 install .[test]
$ cd check_patroni
$ python3 -m venv .venv
$ . .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:
* [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/)
## config file
## Config file
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]
lag=100
```
## thresholds
## Thresholds
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:
```
## cluster services
## Cluster services
### cluster_config_has_changed
```
@ -161,7 +175,7 @@ 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:
* `OK`: If the cluster is in maintenance mode.
@ -198,7 +212,8 @@ Options:
--help Show this message and exit.
```
## node services
## Node services
### node_is_alive
```

View file

@ -345,7 +345,7 @@ def cluster_config_has_changed(
@click.pass_context
@nagiosplugin.guarded
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
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_
helpme
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
source ~venv/bin/activate
$ git clone <FIXME>
```
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 .
pip3 install .[dev]
pip3 install .[test]
$ cd check_patroni
$ python3 -m venv .venv
$ . .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:
* [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/)
## config file
## Config file
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]
lag=100
```
## thresholds
## Thresholds
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_
readme
readme "## cluster services"
readme "## Cluster services"
readme
readme "### cluster_config_has_changed"
helpme cluster_config_has_changed
readme "### cluster_has_leader"
@ -91,7 +103,8 @@ readme "### cluster_is_in_maintenance"
helpme cluster_is_in_maintenance
readme "### cluster_node_count"
helpme cluster_node_count
readme "## node services"
readme "## Node services"
readme
readme "### node_is_alive"
helpme node_is_alive
readme "### node_is_pending_restart"