Keep the health of container applications.
ckeeper can be deployed on each docker host, and it will automatically check the health status, e.g., validate if the web service online, and run specified operations on unhealthy containers, e.g., restart.
The default configuration is in ckeeper.yaml.
There are two ways to use ckeeper: docker image (recommended) and local installation.
$ docker run \
-v YOUR_CONFIG_FILE:/cmonit/ckeeper.yaml \
yeasy/ckeeper \
start --logging-level=debug
$ make run
level: Set output logging message level: debug|info|warning|error|critical.daemon: The daemon url of the container hostretries: Each check will run how many tries before thinking it unhealthy.interval: Seconds between two check.Define how to decide unhealthy status and what action to take.
You can put multiple rules here, each rule will be processed in order.
For each rule:
option: Used to select containers to check health, following the ListOption.target: Think as healthy if the target cmd's running result is true.action: What action to take if the target is not met. If the target is not set, then take action by default. Valid action values include:
start: Start the containerrestart: Restart the containerstop: Stop the containerpause: Pause the containerunpause: Un-pause the containerrm: Remove the containerprint: Print the information of the matched containerignore: Take no actionThe target cmd can be customized easily to achieve flexible health as the user needs.
E.g., the following rule will keep every running web containers serving normally on port 80, otherwise, restart it.
rule_web:
option:
All: true
Filters:
status:
- running
target: '[[ `curl -sL -w "%{http_code}\\n" CONTAINER:80 -o /dev/null` == "200" ]]'
action: "restart"
The following rule will start all containers in exited or paused status.
rule_start:
option: # container filter
All: true
Filters:
status:
- exited
- paused
action: "start"
$ make test
Content type
Image
Digest
Size
247 MB
Last updated
about 10 years ago
docker pull yeasy/ckeeper