Commit Graph

70 Commits

Author SHA1 Message Date
Frank Schröder 825f72f5ef agent: support custom header and method for http checks (#3106)
This patch adds support for custom headers and
method for HTTP checks.

Fixes #2474
Fixes #2657
Fixes #3106
2017-06-07 01:11:56 +02:00
Frank Schroeder 8ad66f4bea
agent: support custom check id and name
This patch adds support for a custom check id and name when
registering a service.

This is achieved by adding a CheckID and a Name field to the
CheckType structure which is used to register checks with a
service and when returning health check definitions.

CheckDefinition is a superset of CheckType which duplicates
some of the fields of CheckType. This patch decouples these
two structures by removing the embedding of CheckType in
CheckDefinition.

Fixes #3047
2017-05-17 20:17:08 +02:00
Frank Schroeder 3403cd4372 golint: Fix existing comments
This needs more work.
2017-04-25 09:26:13 -07:00
Frank Schroeder 3e00e36f41 golint: Untangle if blocks with return in else 2017-04-25 09:26:13 -07:00
Frank Schroeder cf3ec1cf5c golint: Rename fields and structs 2017-04-25 09:26:13 -07:00
Frank Schroeder eddb1af603 Remove duplicate constants
This patch removes duplicate internal copies of constants in the structs
package which are also defined in the api package. The api.KVOp type
with all its values for the TXN endpoint and the api.HealthXXX constants
are now used throughout the codebase.

This resulted in some circular dependencies in the testutil package
which have been resolved by copying code and constants and moving the
WaitForLeader function into a separate testrpc package.
2017-04-20 09:54:49 -07:00
James Tancock 5151c64f54 Standardize the case of all check log messages 2017-01-05 08:34:20 +00:00
James Phillips 2f341738a1 Removes stale reference to reap lock which causes a panic. (#2490) 2016-11-09 09:52:07 -08:00
Kyle McCullough 73b281a27c Add setting to skip ssl certificate verification for HTTP checks (#1984)
* http check: add setting to skip ssl certificate verification

* update http check documentation

* fix typo in documentation

* Add TLSSkipVerify to agent api
2016-11-03 13:17:30 -07:00
James Phillips 4a3d7db24f
Adds ability to deregister a service based on critical check state longer than a timeout. 2016-08-16 01:00:26 -07:00
Sean Chittenden 63adcbd5ef
Revert "Move `structs.CheckID` to a new top-level package, `types`."
This reverts commit 2bbd52e3b44ff1b60939a8400264d534662d6d51.
2016-06-07 16:59:02 -04:00
Sean Chittenden cbb945e76a
Move `structs.CheckID` to a new top-level package, `types`.
Per discussion w/ @slackpad, move this type to its own top-level package
2016-06-07 16:59:02 -04:00
Sean Chittenden f5ab25163e
Move `structs.CheckID` to a new top-level package, `types`.
Per discussion w/ @slackpad, move this type to its own top-level package
2016-06-07 16:59:02 -04:00
Sean Chittenden ddbe64a8c8
Float a type balloon. Some strings are square pegs in round holes.
This experiment was brought about because of variable naming
confusion where name and checkIDs were interchanged.  Gave CheckID
an Qualified Type Name and chased downstream changes.
2016-06-07 16:59:02 -04:00
Matt Shean fe4107019e add Timeout field to CheckMonitor 2016-04-20 11:41:30 -07:00
Ryan Uber 8cc16b8238 agent: limit HTTP check output to 4k 2016-04-14 14:28:07 -07:00
James Phillips 6e2c106006 Merge pull request #1819 from hashicorp/f-check-accept
Adds default set of accept headers for HTTP checks.
2016-03-09 21:12:25 -08:00
James Phillips 4cb16808f4 Adds default set of accept headers for HTTP checks. 2016-03-09 21:11:20 -08:00
James Phillips f46fa33278 Tweaks formatting of inline output messages. 2016-03-02 19:47:00 -08:00
James Phillips 70575002d9 Retains the last output when a TTL check times out. 2016-03-02 17:58:01 -08:00
Stefan Engstrom 525cb0abc1 add accept header */* for agent check 2016-02-19 10:31:00 -06:00
Sean Chittenden 7af6a94edb 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 343838f12b Adds support for the reap lock. 2016-01-12 21:10:25 -08:00
James Phillips 95c708f65e 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 3d1702969f Fixes a go vet finding. 2015-10-29 12:47:20 -07:00
Diptanu Choudhury 423f7fbcac Not adding the docker check if we couldn't create the client 2015-10-26 16:45:12 -07:00
Diptanu Choudhury f5f5ed0c79 Making sure the script is not empty if it's a docker check 2015-10-26 16:27:48 -07:00
Diptanu Choudhury b4af7f44af Updated the comment for CheckType 2015-10-26 15:28:13 -07:00
Diptanu Choudhury 4c1818eb61 Collect and truncate the output from docker exec 2015-10-26 15:19:35 -07:00
Diptanu Choudhury 809e9f5284 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 31cdf4fe64 Added some tests for docker check 2015-10-26 12:59:40 -07:00
Diptanu Choudhury 40f72a8323 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 d695012e40 Adding a debug log to indicate the exit code of failed check 2015-10-26 10:35:51 -07:00
Diptanu Choudhury 83db728133 Registering the Exec with Docker Daemon everytime the check is invoked 2015-10-26 10:23:57 -07:00
Diptanu Choudhury 71ede8addb Implemented Docker health checks 2015-10-26 10:23:57 -07:00
James Phillips 088603949c Runs go fmt (sorts new go-cleanhttp imports). 2015-10-23 17:14:35 -07:00
Jeff Mitchell 1e3840b044 Update cleanhttp repo location 2015-10-22 14:14:22 -04:00
Jeff Mitchell 9a5fd5424a Use cleanhttp to get rid of DefaultTransport 2015-10-22 10:47:50 -04:00
Peter Fern b023904298 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 7597d3d798 agent: first stab at persisting check state 2015-06-05 16:17:07 -07:00
Anton Lindström ce93fdd76b Set the User Agent for HTTP health checks 2015-05-18 19:12:10 +02:00
Armon Dadgar 8d86290ebf Fixing merge conflict 2015-05-11 16:48:10 -07:00
Ryan Uber 92add18e1e agent: persist tokens from API registrations 2015-04-27 19:01:02 -07:00
Ryan Mills 275af975e8 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 952ec284a4 agent: disable HTTP keepalives for checks 2015-03-15 13:30:50 -07:00
artushin 2ae843d51c oops. DefaultTransport being used. 2015-02-12 10:11:22 -06:00
artushin 5ec92971ac close idle connections after stopping http checks to service 2015-02-11 18:29:51 -06:00
arnaud briche e87afe341b - 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 674be58e55 agent: support multiple checks per service 2015-01-20 21:48:42 -08:00
Armon Dadgar 96c7ce120e command/agent: Minor cleanups 2015-01-13 12:18:18 -08:00