Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
|Build Status| |Code Climate| |Test Coverage| |Downloads|


============
check_docker
============

Nagios/NRPE compatible plugins for checking docker based services. Currently there are two nagios checks
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
Expand All @@ -15,7 +12,7 @@ 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
- 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?
Expand All @@ -25,33 +22,32 @@ With **check_docker** can use it to check and alert on

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.
- if a node is not joined to a Docker Swarm
- if a service is running in a Swarm

These plugins require python 3. It is tested on 3.5 and greater but may work on older
versions of 3.
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.

Installation
-----------------

With pip
These plugins require Python 3.

With pip:
::

pip3 install check_docker
--or--
pip install check_docker

With curl
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
With wget:
::

wget -O /usr/local/bin/check_docker https://raw.githubusercontent.com/timdaman/check_docker/master/check_docker/check_docker.py
Expand All @@ -75,7 +71,7 @@ check_docker Usage
[--insecure-registries INSECURE_REGISTRIES [INSECURE_REGISTRIES ...]]
[--restarts WARN:CRIT] [--no-ok] [--no-performance] [-V]

Check docker containers.
Check Docker containers.

optional arguments:
-h, --help show this help message and exit
Expand All @@ -101,7 +97,7 @@ check_docker Usage
--threads THREADS This + 1 is the maximum number of concurent
threads/network connections. (default: 10)
--cpu WARN:CRIT Check cpu usage percentage taking into account any
limits. Valid values are 0 - 100.
limits.
--memory WARN:CRIT:UNITS
Check memory usage taking into account any limits.
Valid values for units are %,B,KB,MB,GB.
Expand Down Expand Up @@ -147,7 +143,7 @@ check_swarm Usage
--secure-connection [<ip/host address>:<port>]
Where to find TLS protected docker daemon socket.
--timeout TIMEOUT Connection timeout in seconds. (default: 10.0)
--swarm Check swarm status
--swarm Check whether or not this node is connected to a swarm
--service SERVICE [SERVICE ...]
One or more RegEx that match the names of the
services(s) to check.
Expand All @@ -157,15 +153,5 @@ check_swarm Usage
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
4 changes: 2 additions & 2 deletions check_docker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Nagios/NRPE compatible plugins for checking docker based services"""
__version__ = "2.2.2"
"""Nagios/NRPE compatible plugins for checking Docker based services"""
__version__ = "2.3.0"
4 changes: 2 additions & 2 deletions check_docker/check_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
__copyright__ = "Copyright 2019"
__credits__ = ['Tim Laurence']
__license__ = "GPL"
__version__ = "2.2.2"
__version__ = "2.3.0"

'''
nrpe compatible check for docker containers.
Expand Down Expand Up @@ -824,7 +824,7 @@ def process_args(args):
action='store',
type=str,
metavar='WARN:CRIT',
help='Check cpu usage percentage taking into account any limits. Valid values are 0 - 100.')
help='Check cpu usage percentage taking into account any limits.')

# Memory
parser.add_argument('--memory',
Expand Down
4 changes: 2 additions & 2 deletions check_docker/check_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
__copyright__ = "Copyright 2019"
__credits__ = ['Tim Laurence']
__license__ = "GPL"
__version__ = "2.2.2"
__version__ = "2.3.0"

'''
nrpe compatible check for docker swarm
Expand Down Expand Up @@ -299,7 +299,7 @@ def process_args(args):
dest='swarm',
default=None,
action='store_true',
help='Check swarm status')
help='Check whether or not this node is connected to a swarm')

# Service
swarm_group.add_argument('--service',
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "check_docker"
version = "2.2.2"
version = "2.3.0"
description = "Nagios/NRPE compatible plugins for checking Docker based services"
license = "GPL-3.0"
authors = ["Tim Laurence <timdaman@gmail.com>"]
Expand All @@ -27,7 +27,4 @@ packages = [

[tool.poetry.scripts]
check_docker = "check_docker.check_docker:main"
check_swarm = "check_docker.check_swarm:main"



check_swarm = "check_docker.check_swarm:main"