Commit Graph

282 Commits

Author SHA1 Message Date
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 d0348d1291 Merge pull request #1004 from i0rek/advertise_addrs
Add advertise_addrs.
2015-06-23 12:32:07 -07:00
Hans Hasselberg 267e0caf81 Implement advertise_addrs for SerfLan, SerfWan and RPC.
Fixes #550.
This will make it possible to configure the advertised adresses for
SerfLan, SerfWan and RPC. It will enable multiple consul clients on a
single host which is very useful in a container environment.

This option might override advertise_addr and advertise_addr_wan
depending on the configuration.

It will be configureable with advertise_addrs. Example:

{
  "advertise_addrs": {
    "serf_lan": "10.0.120.91:4424",
    "serf_wan": "201.20.10.61:4423",
    "rpc": "10.20.10.61:4424"
  }
}
2015-06-23 21:23:45 +02:00
Ryan Uber 69921808ee agent: use persist/load/purge convention for function names 2015-06-08 09:35:10 -07:00
Ryan Uber 1636a35289 agent: check state is purged if expired 2015-06-05 16:59:41 -07:00
Ryan Uber 2ee8fa8e15 agent: purge check state when checks are deregistered 2015-06-05 16:57:14 -07:00
Ryan Uber 7e6e861394 agent: testing state persistence, recovery, and expiration 2015-06-05 16:45:05 -07:00
Ryan Uber 7597d3d798 agent: first stab at persisting check state 2015-06-05 16:17:07 -07:00
Ryan Uber ebe57a1f65 agent: refactor loadChecks/loadServices, fixes a few minor bugs 2015-06-04 14:33:30 -07:00
Armon Dadgar ebf961ef8b Merge pull request #927 from hashicorp/f-tls
Add new `verify_server_hostname` to mitigate possibility of MITM
2015-05-11 18:15:16 -07:00
Armon Dadgar 8d86290ebf Fixing merge conflict 2015-05-11 16:48:10 -07:00
Armon Dadgar a485eb8447 agent: copy config into consul config 2015-05-11 15:16:13 -07:00
Ryan Uber 3ed0146e44 agent: use service ID field to determine associated health checks during deregister 2015-05-07 15:30:01 -07:00
Ryan Uber 204c11ec01 agent: restore check status when re-registering (updating) services 2015-05-06 12:28:42 -07:00
Ryan Uber 8ef01236e1 agent: allow persisted services to be updated on disk 2015-05-05 22:36:45 -07:00
Ryan Uber 739d1fdf03 Merge pull request #891 from hashicorp/f-token
ACL tokens for service/check registration
2015-05-05 22:17:31 -07:00
Ryan Uber 2b62f2f172 agent: use an additional parameter for passing tokens 2015-05-04 17:48:05 -07:00
Ryan Uber 18356328c4 agent: restore tokens for services and checks in config 2015-04-28 12:44:46 -07:00
Ryan Uber 663a86f9b9 agent: backwards compat for persisted services from pre-0.5.1 2015-04-28 12:18:41 -07:00
Ryan Uber 442933650e agent: safer read methods for tokens 2015-04-28 11:53:53 -07:00
Ryan Uber 1557f7f19c agent: test coverage loading service/check tokens from persisted files 2015-04-27 22:46:01 -07:00
Ryan Uber bebb5d9641 agent: add service/check token methods to reduce invasiveness 2015-04-27 22:01:01 -07:00
Ryan Uber 92add18e1e agent: persist tokens from API registrations 2015-04-27 19:01:02 -07:00
Ryan Uber bfb27d18cd agent: initial pass threading through tokens for services/checks 2015-04-27 18:33:46 -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
pepov bac3ae9494 Add configuration option to specify a separate address for advertising on the wan 2015-03-28 16:08:19 +01:00
Michael Fraenkel 8c26836783 Support SesionTTLMin configuration
- Allow setting SessionTTLMin
- Validate on the Server
2015-03-27 05:13:57 -07:00
Ryan Uber 04a2faed22 agent: warn and purge checks which cannot be restored from agent state 2015-03-11 16:13:31 -07:00
Armon Dadgar b319c41bd9 agent: Snapshot and restore health state on reload. Fixes #693 2015-02-17 12:00:04 -08:00
Ryan Uber 103e9e7fc1 agent: clarify the valid characters for dns 2015-02-09 09:59:27 -08:00
Ryan Uber 722b255816 agent: warn on service tags with invalid chars 2015-02-09 09:30:06 -08:00
Ryan Uber 5e801c905d agent: Warn on dns-incompatible characters during service registration. Fixes #683. 2015-02-09 09:23:17 -08: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
foostan 401bc71cb2 Validate ServiceID/CheckID when deregistering. 2015-01-27 01:06:57 +09:00
Armon Dadgar e1a5d537d4 Merge pull request #625 from hashicorp/f-maintcmd
New "maint" command
2015-01-22 11:56:49 -08:00
Ryan Uber 44f3c20e50 command/maint: clean up 2015-01-22 11:14:28 -08:00
Ryan Uber 09fd2a7e94 command/maint: display active maintenance when no args are passed 2015-01-22 10:26:17 -08:00
Armon Dadgar cf04d6ae31 Merge pull request #622 from hashicorp/f-sockets
Unix domain sockets
2015-01-21 16:30:03 -08:00
Ryan Uber 124e7bfa7e agent: use const for default maintenance reason strings 2015-01-21 14:53:52 -08:00
Ryan Uber f00b5b542e agent: support passing ?reason= for custom notes field values on maintenance checks 2015-01-21 12:21:57 -08:00
Ryan Uber b6a0f2baae agent: fix maintenance check ID 2015-01-21 11:03:42 -08:00
Ryan Uber 674be58e55 agent: support multiple checks per service 2015-01-20 21:48:42 -08:00
Ryan Uber 21dd95d9af agent: beginning socket user/group/mode support as discussed in #612 2015-01-20 13:44:27 -08:00
Ryan Uber ba2d0fa7e3 agent: maintenance logging + unique service check IDs 2015-01-16 15:38:13 -08:00
Ryan Uber 7748c62d09 agent: node maintenance mode works 2015-01-16 15:38:13 -08:00
Ryan Uber 9ee1e6e858 agent: maintenance mode api's are idempotent 2015-01-16 15:37:52 -08:00
Ryan Uber 8819d71f99 agent: maintenance mode is persistent 2015-01-16 15:37:52 -08:00
Ryan Uber 3fbb2be6c0 agent: test agent service maintenance mode 2015-01-16 15:37:51 -08:00
Ryan Uber 2973cd9131 agent: first pass at service maintenance mode 2015-01-16 15:37:51 -08:00
Ryan Uber f01bb5cf3b agent: error if binding to existing socket file 2015-01-16 12:39:15 -08:00
Nicholas Capo 98eb935392 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 50853265dd command/agent: Stop HTTP checks when the check is removed 2015-01-12 22:34:39 +00:00
Nicholas Capo fb5ba8d97d 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 Uber a24f6e3d4d agent: test service and check unloading 2015-01-07 22:32:14 -08:00
Ryan Uber 51fe9f32ff agent: consolidate service loading code, better logging 2015-01-07 22:01:43 -08:00
Ryan Uber cfde9313de agent: separate service and check loading/unloading concerns 2015-01-07 22:01:20 -08:00
Ryan Uber 0b9f2b0954 agent: persist service/check data using hashed service/check IDs (fixes #573) 2015-01-07 19:11:21 -08:00
Veres Lajos 3b1068387a typofixes - https://github.com/vlajos/misspell_fixer 2014-12-04 23:25:06 +00:00
Ryan Uber dd4fadfc9e agent: persist CheckType with health checks 2014-11-29 12:54:37 -08:00
Ryan Uber b7587cac42 agent: allow config reload to modify checks/services persistence
This change consolidates loading services and checks from both config
and persisted state into methods on the agent. As part of this, we
introduce optional persistence when calling RemoveCheck/RemoveService.

Fixes a bug where config reloads would kill persisted services/checks.
Also fixes an edge case:

1. A service or check is registered via the HTTP API
2. A new service or check definition with the same ID is added to config
3. Config is reloaded

The desired behavior (which this implements) is:

1. All services and checks deregistered in memory
2. All services and checks in config are registered first
3. All persisted checks are restored using the same logic as the agent
   start sequence, which prioritizes config over persisted, and removes
   any persistence files if new config counterparts are present.
2014-11-26 12:46:42 -08:00
Ryan Uber 9f9087badb agent: prefer config over persisted services/checks (#497) 2014-11-24 19:40:53 -08:00
Ryan Uber 2ebe85414f agent: pass error through when writing state files 2014-11-24 01:58:39 -08:00
Ryan Uber 79ba25b94d agent: default restored checks to critical status 2014-11-24 01:15:18 -08:00
Ryan Uber 46a5272a8a agent: first pass at local service and check persistence 2014-11-24 01:10:27 -08:00
Ryan Uber 8a652c6ffa agent: fix loading keyring on agent start 2014-11-19 16:37:40 -08:00
Ryan Uber 7a74f559b9 command: remove -init argument from keyring, auto-persist keyrings when using agent -encrypt 2014-11-19 16:35:13 -08:00
Ryan Uber 431b366d4f agent: split keyring functionality out of agent.go 2014-11-19 16:32:32 -08:00
Ryan Uber 2220ccdac2 command: various cleanup 2014-11-19 16:31:06 -08:00
Ryan Uber 353b67826a command: use separate key files for LAN/WAN 2014-11-19 16:31:06 -08:00
Ryan Uber 530f3ba747 command/keys: refactor, restrict key operations to server nodes 2014-11-19 16:31:06 -08:00
Ryan Uber 8a40f3888c agent: move keyring initialization out of agent, add -init option to keys command 2014-11-19 16:31:06 -08:00
Ryan Uber 0952535e33 agent: fix keyring loading when config is passed off 2014-11-19 16:31:06 -08:00
Ryan Uber b6037ef323 agent: clean up keyring file implementation 2014-11-19 16:31:06 -08:00
Ryan Uber fcb0961436 agent: refactor keyring loader 2014-11-19 16:31:06 -08:00
Ryan Uber 46ce9e936f command/keys: remove key command implemented 2014-11-19 16:30:22 -08:00
Ryan Uber 1ac6b10aed command/keys: use key command implemented 2014-11-19 16:30:22 -08:00
Ryan Uber 7b6f3d6dcc agent: install key command implemented 2014-11-19 16:30:22 -08:00
Ryan Uber 67b179ccc9 command: basic rpc works for keys command 2014-11-19 16:30:21 -08:00
Ryan Uber 4dd1b42477 consul: use rpc layer only for key management functions, add rpc commands 2014-11-19 16:30:21 -08:00
Ryan Uber 471ee9ce8f command: create serf dir if it doesn't exist, document -disable-keyring arg 2014-11-19 16:30:21 -08:00
Ryan Uber 0da6e08d9d consul: fix json marshaling 2014-11-19 16:30:21 -08:00
Ryan Uber e20a724999 consul: first pass at keyring integration 2014-11-19 16:30:20 -08:00
Ryan Uber df5859580f agent: pass notes field through for checks inside of service definitions. Fixes #449 2014-11-06 18:25:21 -08:00
Ryan Uber 2319460904 agent: initialize local consul service tags to fix service sync 2014-10-17 14:29:12 -07:00
Armon Dadgar 4f1fa3a4ce Merge pull request #401 from hashicorp/f-healthcheck
Default services to "critical" state instead of "unknown"
2014-10-15 16:50:38 -07:00
Ryan Uber cfca160cd5 formatting 2014-10-15 14:56:15 -07:00
Ryan Uber 2f93e13da8 consul: kill remaining use of HealthUnknown 2014-10-15 10:14:46 -07:00
Ryan Uber b1e8d351ab agent: re-use ConsulServiceID from consul package 2014-10-14 15:44:11 -07:00
Ryan Uber 4576b4eb29 agent: auto-register the consul service on server nodes 2014-10-14 15:35:00 -07:00
Armon Dadgar 93c17db1b2 agent: remove userEventEnc type 2014-08-28 10:56:30 -07:00
Armon Dadgar 2d03146d3b agent: Adding event ingestion 2014-08-27 17:01:10 -07:00
Armon Dadgar 314743c111 agent: working on user events 2014-08-27 16:49:12 -07:00
Armon Dadgar 1c341e6766 consul: expose UserEvent from Serf 2014-08-26 18:50:03 -07:00
Armon Dadgar cae4b421a3 agent: Adding ACL master token 2014-08-18 15:46:20 -07:00
Armon Dadgar a8063457f8 consul: ACL setting passthrough 2014-08-18 15:46:20 -07:00
Armon Dadgar 924e4bc7f1 Rename Expect to BootstrapExpect. Fixes #223. 2014-06-19 17:08:55 -07:00
Armon Dadgar 5b2941d43e Fixing merge conflict 2014-06-18 15:48:46 -07:00
Armon Dadgar a05e1aee15 agent: Fixing missing copy of RejoinAfterLeave flag. #110 2014-06-18 10:32:19 -07:00
Armon Dadgar 10c120bf9d agent: Fix issues with re-registration. Fixes #216 2014-06-17 16:48:19 -07:00
Robert Xu c60fd0542a Add expect bootstrap '-expect=n' mode.
This allows for us to automatically bootstrap a cluster of nodes after
'n' number of server nodes join. All servers must have the same 'n' set, or
they will fail to join the cluster; all servers will not join the peer set
until they hit 'n' server nodes.

If the raft commit index is not empty, '-expect=n' does nothing because it
thinks you've already bootstrapped.

Signed-off-by: Robert Xu <robxu9@gmail.com>
2014-06-16 17:40:33 -04:00
Armon Dadgar 441d613e1b agent: Copy ServerName config 2014-06-13 11:27:44 -07:00
Armon Dadgar b144633815 consul: Gossip the build using Serf 2014-06-06 15:36:40 -07:00
Armon Dadgar 42e3729a7c agent: Add version to info output 2014-06-06 14:40:22 -07:00
Armon Dadgar acc048036b consul: Ensure clients also implement LocalMember 2014-05-29 11:21:56 -07:00
William Tisäter d0e447d29b Add `/v1/agent/self` and return local agent config 2014-05-27 01:15:33 +02:00
Mitchell Hashimoto 78b7c57ba3 command/agent: find proper private IP on Windows
/cc @armon
2014-05-15 11:27:30 -07:00
Armon Dadgar 1256bf37f0 agent: Minor cleanups 2014-05-06 12:43:33 -07:00
Carlos Diaz-Padron 4124ddf763 Return pid file errors and fix help formatting 2014-05-06 13:04:22 -04:00
Carlos Diaz-Padron 60ef5a8a12 Add flag to agent to write pid file 2014-05-05 23:39:18 -04:00
Armon Dadgar 018482dc4c Store check output in dedicated field. Fixes #59. 2014-04-21 16:20:22 -07:00
Armon Dadgar 6bbe8fd493 agent: Adding minimum check interval. Fixes #64. 2014-04-21 14:42:42 -07:00
Haney Maxwell 0a5d75da5d documentation: minor comment consistency in agent.go 2014-04-17 22:46:31 -07:00
Armon Dadgar d8ca1f367c agent: Fixing wrong port usage for server 2014-04-14 12:37:49 -07:00
Armon Dadgar 8dd1e51bae agent: Simplifying configs 2014-04-11 15:46:55 -07:00
Armon Dadgar 922014530f agent: First pass at improving flags 2014-04-11 15:22:35 -07:00
Armon Dadgar 592953309e agent: Passthrough of TLS configurations 2014-04-07 15:07:00 -07:00
Armon Dadgar ffca4f5544 agent: Support protocol version setting 2014-03-09 15:57:03 -07:00
Armon Dadgar 015670d04e agent: Adding Stats() export 2014-02-23 16:42:39 -08:00
Armon Dadgar e12e5f7f68 agent: adding ability to reload services and checks 2014-02-07 12:19:56 -08:00
Armon Dadgar c1637b4978 agent: Adding server up callback to make state sync faster 2014-02-07 12:11:34 -08:00
Armon Dadgar 1eb0a76ee8 agent: Adding methods to register services and checks 2014-01-30 13:39:02 -08:00
Armon Dadgar c4f516d034 Adding CheckMonitors and CheckTTLs to agent 2014-01-21 12:05:56 -08:00
Armon Dadgar 410a0de0c8 Seperate localState from Agent 2014-01-21 11:52:25 -08:00
Armon Dadgar 1feec1adf8 First pass at local state + anti-entropy 2014-01-15 15:14:50 -10:00
Armon Dadgar 93dac80a86 Adding support for advertise address 2013-12-31 16:45:13 -08:00
Armon Dadgar f4692b468f Pulling in the RPC framework from serf 2013-12-30 14:42:41 -08:00
Armon Dadgar f33a9c1d2d Serf API changes 2013-12-27 14:50:02 -08:00
Armon Dadgar 9a2d3c144a Adding a bootstrap flag to allow single server raft 2013-12-24 16:48:07 -08:00
Armon Dadgar 39d9e3e78f More HTTP endpoints 2013-12-23 16:20:51 -08:00
Armon Dadgar 8caf0034db Working on the agent 2013-12-20 16:39:32 -08:00
Armon Dadgar aeccadd217 Filling in Agent basics 2013-12-20 15:33:13 -08:00
Armon Dadgar 289e1c598b Agent skeleton 2013-12-19 17:14:46 -08:00