From 8572ac135c839a2590a733bcc048b1adbf1158f6 Mon Sep 17 00:00:00 2001 From: Blake Covarrubias Date: Fri, 1 Nov 2019 23:18:46 -0700 Subject: [PATCH] Add missing docs for checks Watch type (#5188) Add configuration examples for specifying watch checks by health check state or service, and corresponding CLI examples. Resolves: #5188 --- website/source/docs/agent/watches.html.md | 32 ++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/website/source/docs/agent/watches.html.md b/website/source/docs/agent/watches.html.md index 6fd9795fae..f2f2dfba86 100644 --- a/website/source/docs/agent/watches.html.md +++ b/website/source/docs/agent/watches.html.md @@ -360,9 +360,39 @@ filter to a specific state. By default, it will watch all checks. This maps to the `/v1/health/state/` API if monitoring by state or `/v1/health/checks/` if monitoring by service. +Here is an example configuration for monitoring by state: + +```json +{ + "type": "checks", + "state": "passing", + "args": ["/usr/bin/my-check-handler.sh", "-passing"] +} +``` + +Here is an example configuration for monitoring by service: + +```json +{ + "type": "checks", + "service": "redis", + "args": ["/usr/bin/my-check-handler.sh", "-redis"] +} +``` + +Or, using the watch command: + +State: + + $ consul watch -type=checks -state=passing /usr/bin/my-check-handler.sh -passing + +Service: + + $ consul watch -type=checks -service=redis /usr/bin/my-check-handler.sh -redis + An example of the output of this command: -```javascript +```json [ { "Node": "foobar",