open-consul/website/source/docs/commands/watch.html.markdown.erb

55 lines
1.9 KiB
Plaintext
Raw Normal View History

2014-08-22 00:25:42 +00:00
---
layout: "docs"
page_title: "Commands: Watch"
sidebar_current: "docs-commands-watch"
description: |-
The `watch` command provides a mechanism to watch for changes in a particular data view (list of nodes, service members, key value, etc) and to invoke a process with the latest values of the view. If no process is specified, the current values are dumped to stdout which can be a useful way to inspect data in Consul.
2014-08-22 00:25:42 +00:00
---
# Consul Watch
Command: `consul watch`
The `watch` command provides a mechanism to watch for changes in a particular
2014-08-22 00:25:42 +00:00
data view (list of nodes, service members, key value, etc) and to invoke
a process with the latest values of the view. If no process is specified,
2016-11-25 18:34:08 +00:00
the current values are dumped to STDOUT which can be a useful way to inspect
2014-08-22 00:25:42 +00:00
data in Consul.
There is more [documentation on watches here](/docs/agent/watches.html).
## Usage
Usage: `consul watch [options] [child...]`
The only required option is `-type` which specifies the particular
data view. Depending on the type, various options may be required
or optionally provided. There is more documentation on watch
[specifications here](/docs/agent/watches.html).
#### API Options
2014-08-22 00:25:42 +00:00
<%= partial "docs/commands/http_api_options_client" %>
<%= partial "docs/commands/http_api_options_server" %>
2014-08-22 00:25:42 +00:00
#### Command Options
2014-08-22 00:25:42 +00:00
* `-key` - Key to watch. Only for `key` type.
2014-08-29 00:22:56 +00:00
* `-name`- Event name to watch. Only for `event` type.
* `-passingonly=[true|false]` - Should only passing entries be returned. Defaults to
2016-11-25 18:34:08 +00:00
`false` and only applies for `service` type.
2014-08-22 00:25:42 +00:00
* `-prefix` - Key prefix to watch. Only for `keyprefix` type.
* `-service` - Service to watch. Required for `service` type, optional for `checks` type.
* `-state` - Check state to filter on. Optional for `checks` type.
* `-tag` - Service tag to filter on. Optional for `service` type.
2016-11-25 18:34:08 +00:00
* `-type` - Watch type. Required, one of "`key`, `keyprefix`, `services`,
`nodes`, `service`, `checks`, or `event`.
2014-08-22 00:25:42 +00:00