A simple healthcheck wrapper to monitor zookeeper.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zookeeper-healthcheck-0.0.1.tar.gz
.
File metadata
- Download URL: zookeeper-healthcheck-0.0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 361b96b45ed5b8e82fd2ec30af1aa5f24767a90e07facd35742ba10e1fba8dc5 |
|
MD5 | 6f52e5d1427b05ac076916bbacf4384a |
|
BLAKE2b-256 | e35764f274eeaa4960fa08e39f0972bda3e4149cd5e60d97106c37b5ed760b41 |
File details
Details for the file zookeeper_healthcheck-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: zookeeper_healthcheck-0.0.1-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6320f0a1df567107cd8b008b6751062fb7ec78d7c90f489d6d689340509e000 |
|
MD5 | 92336876d97ca8a3eac344a8b441768d |
|
BLAKE2b-256 | 838ecf2bc57d4fc9e1d0d6c8ae238ba8ea70c82ad7a7ede2f8b7338c58ab55ba |