From e4f2887ba3e129593964dfea4fa8414f8832f6c3 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 28 Oct 2015 14:19:57 -0700 Subject: [PATCH 1/3] Added some docs for the docker check --- .../source/docs/agent/checks.html.markdown | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/website/source/docs/agent/checks.html.markdown b/website/source/docs/agent/checks.html.markdown index 336b6e99fb..79e749d4f0 100644 --- a/website/source/docs/agent/checks.html.markdown +++ b/website/source/docs/agent/checks.html.markdown @@ -15,7 +15,7 @@ service. If not associated with a service, the check monitors the health of the A check is defined in a configuration file or added at runtime over the HTTP interface. Checks created via the HTTP interface persist with that node. -There are three different kinds of checks: +There are four different kinds of checks: * Script + Interval - These checks depend on invoking an external application that performs the health check, exits with an appropriate exit code, and potentially @@ -60,6 +60,8 @@ There are three different kinds of checks: last known status of the check across restarts. Persisted check status is valid through the end of the TTL from the time of the last check. +* Docker + Interval - These checks depend on invoking an external application which is packaged within a Docker Container. The application is triggered within the running container via the Docker Exec API. We expect Consul agent user has access to the Docker HTTP API or the unix socket. Consul uses DOCKER_HOST to determine the Docker API endpoint. The application is expected to run, perform health check of the service running inside the container, exit with an appropriate exit code similar to the Script check. The check should be paired with an invocation interval. The shell on which the check has to be performed is configurable which makes it possible to run containers which has different shells on the same host. + ## Check Definition A script check: @@ -116,6 +118,20 @@ A TTL check: } ``` +A Docker check: +```javascript +{ +"check": { + "id": "mem-util", + "name": "Memory utilization", + "docker_container_id": "f972c95ebf0e", + "shell": "/bin/bash", + "script": "/usr/local/bin/check_mem.py", + "interval": "10s" + } +} +``` + Each type of definition must include a `name` and may optionally provide an `id` and `notes` field. The `id` is set to the `name` if not provided. It is required that all checks have a unique ID per node: if names @@ -130,7 +146,7 @@ Checks may also contain a `token` field to provide an ACL token. This token is used for any interaction with the catalog for the check, including [anti-entropy syncs](/docs/internals/anti-entropy.html) and deregistration. -Script, TCP and HTTP checks must include an `interval` field. This field is +Script, TCP, Docker and HTTP checks must include an `interval` field. This field is parsed by Go's `time` package, and has the following [formatting specification](http://golang.org/pkg/time/#ParseDuration): > A duration string is a possibly signed sequence of decimal numbers, each with From 1633cf9d1c2ba23d92f24d61924221d4d7629e8c Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 28 Oct 2015 14:24:03 -0700 Subject: [PATCH 2/3] Some changes to the docker check docs --- website/source/docs/agent/checks.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/source/docs/agent/checks.html.markdown b/website/source/docs/agent/checks.html.markdown index 79e749d4f0..68bc4b1f20 100644 --- a/website/source/docs/agent/checks.html.markdown +++ b/website/source/docs/agent/checks.html.markdown @@ -60,7 +60,7 @@ There are four different kinds of checks: last known status of the check across restarts. Persisted check status is valid through the end of the TTL from the time of the last check. -* Docker + Interval - These checks depend on invoking an external application which is packaged within a Docker Container. The application is triggered within the running container via the Docker Exec API. We expect Consul agent user has access to the Docker HTTP API or the unix socket. Consul uses DOCKER_HOST to determine the Docker API endpoint. The application is expected to run, perform health check of the service running inside the container, exit with an appropriate exit code similar to the Script check. The check should be paired with an invocation interval. The shell on which the check has to be performed is configurable which makes it possible to run containers which has different shells on the same host. +* Docker + Interval - These checks depend on invoking an external application which is packaged within a Docker Container. The application is triggered within the running container via the Docker Exec API. We expect that the Consul agent user has access to either the Docker HTTP API or the unix socket. Consul uses ```$DOCKER_HOST``` to determine the Docker API endpoint. The application is expected to run, perform health check of the service running inside the container, exit with an appropriate exit code. The check should be paired with an invocation interval. The shell on which the check has to be performed is configurable which makes it possible to run containers which has different shells on the same host. ## Check Definition From c25d0f044f3e8dd9637866b289769fee660fa1f8 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 28 Oct 2015 14:56:55 -0700 Subject: [PATCH 3/3] Some more grammer corrections and formatting to docker check docs --- website/source/docs/agent/checks.html.markdown | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/source/docs/agent/checks.html.markdown b/website/source/docs/agent/checks.html.markdown index 68bc4b1f20..ecb3cdc462 100644 --- a/website/source/docs/agent/checks.html.markdown +++ b/website/source/docs/agent/checks.html.markdown @@ -60,7 +60,15 @@ There are four different kinds of checks: last known status of the check across restarts. Persisted check status is valid through the end of the TTL from the time of the last check. -* Docker + Interval - These checks depend on invoking an external application which is packaged within a Docker Container. The application is triggered within the running container via the Docker Exec API. We expect that the Consul agent user has access to either the Docker HTTP API or the unix socket. Consul uses ```$DOCKER_HOST``` to determine the Docker API endpoint. The application is expected to run, perform health check of the service running inside the container, exit with an appropriate exit code. The check should be paired with an invocation interval. The shell on which the check has to be performed is configurable which makes it possible to run containers which has different shells on the same host. +* Docker + Interval - These checks depend on invoking an external application which +is packaged within a Docker Container. The application is triggered within the running +container via the Docker Exec API. We expect that the Consul agent user has access +to either the Docker HTTP API or the unix socket. Consul uses ```$DOCKER_HOST``` to +determine the Docker API endpoint. The application is expected to run, perform a health +check of the service running inside the container, and exit with an appropriate exit code. +The check should be paired with an invocation interval. The shell on which the check +has to be performed is configurable which makes it possible to run containers which +have different shells on the same host. ## Check Definition