check_docker
check_docker copied to clipboard
Nagios plugin to check docker containers
|Build Status| |Code Climate| |Test Coverage| |Downloads|
============ check_docker
Nagios/NRPE compatible plugins for checking docker based services. Currently there are two nagios checks
- check_docker which checks docker container health
- check_swarm which checks health of swarm nodes and services
With check_docker can use it to check and alert on
- memory consumption in absolute units (bytes, kb, mb, gb) and as a percentage (0-100%) of the container limit.
- CPU usages as a percentage (0-100%) of container limit.
- automatic restarts performed by the docker daemon
- container status, i.e. is it running?
- container health checks are passing?
- uptime, i.e. is it able to stay running for a long enough time?
- the presence of a container or containers matching specified names
- image version, does the running image match that in the remote registry?
- image age, when was the image built the last time?
With check_swarm you can alert
- if a node is not joined to a docker swarm
- if a service is running in a swarm
These checks can communicate with a local docker daemon socket file (default) or with local or remote docker daemons using secure and non-secure TCP connections.
These plugins require python 3. It is tested on 3.5 and greater but may work on older versions of 3.
Installation
With pip ::
pip3 install check_docker
--or--
pip install check_docker
With curl ::
curl -o /usr/local/bin/check_docker https://raw.githubusercontent.com/timdaman/check_docker/master/check_docker/check_docker.py
curl -o /usr/local/bin/check_swarm https://raw.githubusercontent.com/timdaman/check_docker/master/check_docker/check_swarm.py
chmod a+rx /usr/local/bin/check_docker /usr/local/bin/check_swarm
With wget ::
wget -O /usr/local/bin/check_docker https://raw.githubusercontent.com/timdaman/check_docker/master/check_docker/check_docker.py
wget -O /usr/local/bin/check_swarm https://raw.githubusercontent.com/timdaman/check_docker/master/check_docker/check_swarm.py
chmod a+rx /usr/local/bin/check_docker /usr/local/bin/check_swarm
check_docker Usage
::
usage: check_docker.py [-h]
[--connection [/
Check docker containers.
optional arguments:
-h, --help show this help message and exit
--connection [/
check_swarm Usage
::
usage: check_swarm.py [-h]
[--connection [/
Check docker swarm.
optional arguments:
-h, --help show this help message and exit
--connection [/
Gotchas
- When using check_docker with older versions of docker (I have seen 1.4 and 1.5) –status only supports ‘running’, ‘restarting’, and ‘paused’.
- When using check_docker, if no container is specified, all containers are checked. Some containers may return critcal status if the selected check(s) require a running container.
- When using check_docker, --present cannot be used without --containers to indicate what to check the presence of.
.. |Build Status| image:: https://travis-ci.org/timdaman/check_docker.svg?branch=master :target: https://travis-ci.org/timdaman/check_docker .. |Code Climate| image:: https://codeclimate.com/github/timdaman/check_docker/badges/gpa.svg :target: https://codeclimate.com/github/timdaman/check_docker .. |Test Coverage| image:: https://codeclimate.com/github/timdaman/check_docker/badges/coverage.svg :target: https://codeclimate.com/github/timdaman/check_docker/coverage .. |Downloads| image:: http://pepy.tech/badge/check-docker :target: http://pepy.tech/count/check-docker