Commit Graph

49 Commits

Author SHA1 Message Date
Sean Chittenden c470553b6b Factor out duplicate functions into a lib package
Consolidate code duplication and tests into a single lib package.  Most of these functions were from various **/util.go functions that couldn't be imported due to cyclic imports.  The consul/lib package is intended to be a terminal node in an import DAG and a place to stash various consul-only helper functions.  Pulled in hashicorp/go-uuid instead of consolidating UUID access.
2016-01-29 16:57:45 -08:00
James Phillips d22fe5ba62 Adds support for the reap lock. 2016-01-12 21:10:25 -08:00
James Phillips 23536f2b97 Adds Docker checks support to client API.
Also changed `DockerContainerId` to `DockerContainerID`, and updated the agent
API docs to reflect their support for Docker checks.
2015-11-18 07:40:02 -08:00
James Phillips 9107521c17 Fixes a go vet finding. 2015-10-29 12:47:20 -07:00
Diptanu Choudhury fd6d57ccac Not adding the docker check if we couldn't create the client 2015-10-26 16:45:12 -07:00
Diptanu Choudhury 210b968037 Making sure the script is not empty if it's a docker check 2015-10-26 16:27:48 -07:00
Diptanu Choudhury 0a657b2602 Updated the comment for CheckType 2015-10-26 15:28:13 -07:00
Diptanu Choudhury 2276ebc978 Collect and truncate the output from docker exec 2015-10-26 15:19:35 -07:00
Diptanu Choudhury d2bd1b0c3f Extracted the logic of figuring out the shell and fixing the logic to find out if the check is a Docker check 2015-10-26 15:00:34 -07:00
Diptanu Choudhury f445318732 Added some tests for docker check 2015-10-26 12:59:40 -07:00
Diptanu Choudhury d478fa9470 Marking the state of a service as critical if the Docker Daemon doesn't respond while running checks 2015-10-26 11:16:11 -07:00
Diptanu Choudhury b35836fdad Adding a debug log to indicate the exit code of failed check 2015-10-26 10:35:51 -07:00
Diptanu Choudhury 1b1518512c Registering the Exec with Docker Daemon everytime the check is invoked 2015-10-26 10:23:57 -07:00
Diptanu Choudhury c4b85010fb Implemented Docker health checks 2015-10-26 10:23:57 -07:00
James Phillips 2a51d55ce3 Runs go fmt (sorts new go-cleanhttp imports). 2015-10-23 17:14:35 -07:00
Jeff Mitchell 9267f956a2 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 06bb9d5f36 Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
Peter Fern 86edd7169c Add TCP check type
Adds the ability to simply check whether a TCP socket accepts
connections to determine if it is healthy.  This is a light-weight -
though less comprehensive than scripting - method of checking network
service health.

The check parameter `tcp` should be set to the `address:port`
combination for the service to be tested.  Supports both IPv6 and IPv4,
in the case of a hostname that resolves to both, connections will be
attempted via both protocol versions, with the first successful
connection returning a successful check result.

Example check:

```json
{
  "check": {
    "id": "ssh",
    "name": "SSH (TCP)",
    "tcp": "example.com:22",
    "interval": "10s"
  }
}
```
2015-07-24 14:06:05 +10:00
Ryan Uber f1eb739949 agent: first stab at persisting check state 2015-06-05 16:17:07 -07:00
Anton Lindström 74dd2270af Set the User Agent for HTTP health checks 2015-05-18 19:12:10 +02:00
Armon Dadgar f797130228 Fixing merge conflict 2015-05-11 16:48:10 -07:00
Ryan Uber 30f6f1142e agent: persist tokens from API registrations 2015-04-27 19:01:02 -07:00
Ryan Mills 370853d7ff Allow specifying a status field in the agent/service/register and agent/check/register endpoints.
This status must be one of the valid check statuses: 'passing', 'warning', 'critical', 'unknown'.
If the status field is not present or the empty string, the default of 'critical' is used.
2015-04-12 02:00:31 +00:00
Ryan Uber 589a4cc4c7 agent: disable HTTP keepalives for checks 2015-03-15 13:30:50 -07:00
artushin ed2837d7d5 oops. DefaultTransport being used. 2015-02-12 10:11:22 -06:00
artushin 4cbf3a037a close idle connections after stopping http checks to service 2015-02-11 18:29:51 -06:00
arnaud briche 4d105487a8 - add Timeout field to CheckType and CheckHTTP to make http request timeout configurable by the client 2015-01-29 13:37:48 +07:00
Ryan Uber 27de0adf3b agent: support multiple checks per service 2015-01-20 21:48:42 -08:00
Armon Dadgar f3baa0a113 command/agent: Minor cleanups 2015-01-13 12:18:18 -08:00
Nicholas Capo e116c03f86 command/agent: HTTP Check: Create httpClient in Start()
For long (>10s) interval checks the http timeout is 10s, otherwise thetimeout is the interval. This means that a check *should* return
before the next check begins.
2015-01-13 00:01:15 +00:00
Nicholas Capo 27fe823fd2 command/agent: HTTP Check: Include response in check status 2015-01-12 22:35:28 +00:00
Nicholas Capo 1918f39020 command/agent: HTTP check: Any 2xx is OK, 429 is WARNING 2015-01-12 21:58:57 +00:00
Nicholas Capo f2649edcfc command/agent: Add simple HTTP check type
These checks make an `HTTP GET` request every Interval to the specified URL.
The status of the service depends on the HTTP Response Code.
`200` is passing, `503` is warning and anything else is failing.
2015-01-09 16:43:24 -06:00
Ryan Breen b97a35234d Clean up log line and reduce test time. 2014-12-18 09:00:51 -05:00
Ryan Breen 3b77bb7682 Well, that sure is cleaner. 2014-12-17 22:24:41 -05:00
Ryan Breen 3cb88d0a4f Add a randomized start before running CheckMonitors. 2014-12-17 21:44:12 -05:00
Ryan Uber 9e52588cec agent: persist CheckType with health checks 2014-11-29 12:54:37 -08:00
Ryan Uber 398179dcad agent: pass notes field through for checks inside of service definitions. Fixes #449 2014-11-06 18:25:21 -08:00
Ryan Uber ec63686416 consul: kill remaining use of HealthUnknown 2014-10-15 10:14:46 -07:00
Armon Dadgar 04dc1ee64a agent: Refactor script invoke 2014-08-21 14:28:16 -07:00
Armon Dadgar d1889a6f4b agent: Limit health check output to 4K. Fixes #83. 2014-04-29 15:28:56 -07:00
Armon Dadgar 2845d24cfa Store check output in dedicated field. Fixes #59. 2014-04-21 16:20:22 -07:00
Armon Dadgar b1bfd97438 agent: Adding minimum check interval. Fixes #64. 2014-04-21 14:42:42 -07:00
Armon Dadgar d051d9cb23 agent: Adding methods to register services and checks 2014-01-30 13:39:02 -08:00
Armon Dadgar dc11ffd359 agent: Adding CheckType which is used to wrap either a CheckMonitor or CheckTTL 2014-01-30 13:18:05 -08:00
Armon Dadgar f8a0a3706f Allow setting the health check notes 2014-01-20 17:19:20 -10:00
Armon Dadgar c7d8b1dc75 Adding CheckTTL for TTL based checks 2014-01-20 17:12:40 -10:00
Armon Dadgar 870ed8fed6 CheckMonitor runs forever and runs the first check immediately 2014-01-20 16:46:01 -10:00
Armon Dadgar 147018037e Adding basic CheckMonitor to invoke scripts 2014-01-20 16:44:23 -10:00