zookeeper-healthcheck
A simple healthcheck wrapper to monitor ZooKeeper.
ZooKeeper Healthcheck is a simple server that provides a singular API endpoint to determine the health of a ZooKeeper instance. This can be used to alert or take action on unhealthy ZooKeeper instances.
The service checks the health by sending netcat commands as well as checking that ZooKeeper is in a desired mode. It utilizes the commands echo ruok | nc zookeeper-host zookeeper-port and echo stat | nc zookeeper-host zookeeper-port | grep Mode to do so.
By default, the root endpoint / will return 200 OK healthy if ZooKeeper responds imok and is in mode leader or follower. It will return 503 Service Unavailable if ZooKeeper does not respond with imok or if its in an undesired mode (by default standalone).
Usage
ZooKeeper Healthcheck can be installed via pip. Both python and pip are required, as well as echo, nc and grep.
Command-Line
Install zookeeper-healthcheck via pip:
pip install zookeeper-healthcheck
To start the healthcheck server, run:
zookeeper-healthcheck
The server will now be running on localhost:12181.
Configuration
ZooKeeper Healthcheck can be configured via command-line arguments or by environment variables.
Port
The port for the zookeeper-healthcheck API.
| Usage | Value |
|---|---|
| Environment Variable | HEALTHCHECK_PORT |
| Command-Line Argument | --port |
| Default Value | 12181 |
ZooKeeper Host
The host of the ZooKeeper instance to run the health check against. This is used with nc.
| Usage | Value |
|---|---|
| Environment Variable | HEALTHCHECK_ZOOKEEPER_HOST |
| Command-Line Argument | --zookeeper-host |
| Default Value | localhost |
ZooKeeper Port
The port of the ZooKeeper instance to run the health check against. This is used with nc.
| Usage | Value |
|---|---|
| Environment Variable | HEALTHCHECK_ZOOKEEPER_PORT |
| Command-Line Argument | --zookeeper-port |
| Default Value | 2181 |
Healthy Modes
A comma-separated list of ZooKeeper modes to be marked as healthy. Any modes not in this list will mark ZooKeeper as unhealthy.
| Usage | Value |
|---|---|
| Environment Variable | HEALTHCHECK_HEALTHY_MODES |
| Command-Line Argument | --healthy-modes |
| Default Value | leader,follower |
| Valid Values | leader, follower, standalone |
Log Level
The level of logs to be shown by the application.
| Usage | Value |
|---|---|
| Environment Variable | HEALTHCHECK_LOG_LEVEL |
| Command-Line Argument | --log-level |
| Default Value | INFO |
| Valid Values | DEBUG, INFO, WARNING, ERROR |
All healthy responses are logged at INFO. Unhealthy responses are logged at WARNING. Any unexpected errors are logged at ERROR.
License
Copyright (c) 2019 Shawn Seymour.
Licensed under the Apache 2.0 license.
Metadata
Release files for zookeeper-healthcheck 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zookeeper-healthcheck-0.0.1.tar.gz | 5.8 kB | Without provenance | Details for zookeeper-healthcheck-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zookeeper_healthcheck-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for zookeeper_healthcheck-0.0.1-py3-none-any.whl |
Total release size: 18.6 kB
Release files / zookeeper-healthcheck-0.0.1.tar.gz
| Download URL | zookeeper-healthcheck-0.0.1.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
361b96b45ed5b8e82fd2ec30af1aa5f24767a90e07facd35742ba10e1fba8dc5
|
|
BLAKE2b-256 checksum How to use checksums |
e35764f274eeaa4960fa08e39f0972bda3e4149cd5e60d97106c37b5ed760b41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / zookeeper_healthcheck-0.0.1-py3-none-any.whl
| Download URL | zookeeper_healthcheck-0.0.1-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6320f0a1df567107cd8b008b6751062fb7ec78d7c90f489d6d689340509e000
|
|
BLAKE2b-256 checksum How to use checksums |
838ecf2bc57d4fc9e1d0d6c8ae238ba8ea70c82ad7a7ede2f8b7338c58ab55ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Security for zookeeper-healthcheck 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.