{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/consul/issues/591","labels_url":"https://api.github.com/repos/hashicorp/consul/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/591/comments","events_url":"https://api.github.com/repos/hashicorp/consul/issues/591/events","html_url":"https://github.com/hashicorp/consul/pull/591","id":53924650,"number":591,"title":"Support multiple health checks per service","user":{"login":"ryanuber","id":1642288,"avatar_url":"https://avatars.githubusercontent.com/u/1642288?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanuber","html_url":"https://github.com/ryanuber","followers_url":"https://api.github.com/users/ryanuber/followers","following_url":"https://api.github.com/users/ryanuber/following{/other_user}","gists_url":"https://api.github.com/users/ryanuber/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanuber/subscriptions","organizations_url":"https://api.github.com/users/ryanuber/orgs","repos_url":"https://api.github.com/users/ryanuber/repos","events_url":"https://api.github.com/users/ryanuber/events{/privacy}","received_events_url":"https://api.github.com/users/ryanuber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-01-09T22:44:17Z","updated_at":"2015-02-25T09:24:22Z","closed_at":"2015-01-21T06:15:49Z","pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/591","html_url":"https://github.com/hashicorp/consul/pull/591","diff_url":"https://github.com/hashicorp/consul/pull/591.diff","patch_url":"https://github.com/hashicorp/consul/pull/591.patch"},"body":"Allows multiple health checks to be registered for a single service. Preserves backwards compatibility of configs by using a new `checks` field. Registering multiple health checks can be done in a few different ways:\r\n\r\nEmbedded in service definitions in the `checks` key. If there is only a single check, the check ID will be `service:<service name>`. If there are multiple checks, the service IDs will be `service:<service name>:<n>`.\r\n```\r\n{\r\n  \"service\": {\r\n    ...\r\n    \"checks\": [\r\n      {\r\n        \"script\": \"/usr/bin/true\",\r\n        \"interval\": \"10s\"\r\n      },\r\n      ...\r\n    ]\r\n  }\r\n}\r\n```\r\n\r\nIn check configuration files using the `service_id` key. This allows additive configuration of service checks in a `consul.d`-style directory:\r\n```\r\n{\r\n  \"checks\": [\r\n    {\r\n      \"name\": \"redis check\",\r\n      \"script\": \"/usr/bin/true\",\r\n      \"interval\": \"10s\",\r\n      \"service_id\": \"redis\"\r\n    },\r\n    ...\r\n  ]\r\n}\r\n```\r\n\r\nFrom the HTTP API by specifying `service_id` in the check definition. This allows adding additional health checks at runtime, and utilizes the new service/check persistence logic to restore the checks on later agent starts:\r\n```\r\nPUT /v1/agent/check/register\r\n{\r\n  \"name\": \"redis check\",\r\n  \"script\": \"/usr/bin/true\",\r\n  \"interval\": \"10s\",\r\n  \"service_id\": \"redis\"\r\n}\r\n```\r\n\r\nFixes #230."},"comment":{"url":"https://api.github.com/repos/hashicorp/consul/issues/comments/75929423","html_url":"https://github.com/hashicorp/consul/pull/591#issuecomment-75929423","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/591","id":75929423,"user":{"login":"kdlan","id":863872,"avatar_url":"https://avatars.githubusercontent.com/u/863872?v=3","gravatar_id":"","url":"https://api.github.com/users/kdlan","html_url":"https://github.com/kdlan","followers_url":"https://api.github.com/users/kdlan/followers","following_url":"https://api.github.com/users/kdlan/following{/other_user}","gists_url":"https://api.github.com/users/kdlan/gists{/gist_id}","starred_url":"https://api.github.com/users/kdlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdlan/subscriptions","organizations_url":"https://api.github.com/users/kdlan/orgs","repos_url":"https://api.github.com/users/kdlan/repos","events_url":"https://api.github.com/users/kdlan/events{/privacy}","received_events_url":"https://api.github.com/users/kdlan/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T09:24:22Z","updated_at":"2015-02-25T09:24:22Z","body":"This feature seems not documented on https://www.consul.io/docs/agent/http/agent.html#agent_check_register\r\n\r\nBut request is worked\r\n```\r\nPUT /v1/agent/check/register\r\n{\r\n  \"Name\": \"redis check\",\r\n  \"Script\": \"/usr/bin/true\",\r\n  \"Interval\": \"10s\",\r\n  \"ServiceID\": \"redis\"\r\n}\r\n```\r\n"}}