Skip to content

[DOCS] Move watcher to docs folder #33451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ buildRestTests.expectedUnconvertedCandidates = [
'reference/ml/apis/post-data.asciidoc',
'reference/ml/apis/revert-snapshot.asciidoc',
'reference/ml/apis/update-snapshot.asciidoc',
'reference/watcher/apis/put-watch.asciidoc',
'reference/watcher/apis/stats.asciidoc',
'reference/watcher/example-watches/watching-time-series-data.asciidoc',
]

integTestCluster {
Expand Down Expand Up @@ -101,6 +104,7 @@ buildRestTests.docs = fileTree(projectDir) {
exclude 'reference/rollup/apis/delete-job.asciidoc'
exclude 'reference/rollup/apis/get-job.asciidoc'
exclude 'reference/rollup/apis/rollup-caps.asciidoc'
exclude 'reference/watcher/reference/actions.asciidoc'
}

listSnippets.docs = buildRestTests.docs
Expand Down Expand Up @@ -1096,5 +1100,40 @@ buildRestTests.setups['calendar_outages_addevent'] = buildRestTests.setups['cale
{ "description": "event 3", "start_time": "1514160000000", "end_time": "1514246400000"}
]}
'''


buildRestTests.setups['my_inactive_watch'] = '''
- do:
xpack.watcher.put_watch:
id: "my_watch"
active: false
body: >
{
"trigger": {
"schedule": {
"hourly": {
"minute": [ 0, 5 ]
}
}
},
"input": {
"simple": {
"payload": {
"send": "yes"
}
}
},
"condition": {
"always": {}
},
"actions": {
"test_index": {
"index": {
"index": "test",
"doc_type": "test2"
}
}
}
}
- match: { _id: "my_watch" }
'''
buildRestTests.setups['my_active_watch'] = buildRestTests.setups['my_inactive_watch'].replace(
'active: false', 'active: true')
2 changes: 1 addition & 1 deletion docs/reference/rest-api/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ include::{es-repo-dir}/migration/migration.asciidoc[]
include::{es-repo-dir}/ml/apis/ml-api.asciidoc[]
include::{es-repo-dir}/rollup/rollup-api.asciidoc[]
include::{xes-repo-dir}/rest-api/security.asciidoc[]
include::{xes-repo-dir}/rest-api/watcher.asciidoc[]
include::{es-repo-dir}/watcher/apis/watcher-api.asciidoc[]
include::defs.asciidoc[]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions]]
== Actions

Expand Down Expand Up @@ -91,6 +93,7 @@ PUT _xpack/watcher/watch/error_logs_alert
}
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]
<1> There will be at least 15 minutes between subsequent `email_administrator`
action executions.
<2> See <<actions-email, Email Action>> for more information.
Expand Down Expand Up @@ -150,6 +153,7 @@ PUT _xpack/watcher/watch/log_event_watch
}
--------------------------------------------------
// CONSOLE
// TEST[skip:skip:non-compliant license]

<1> There will be at least 15 minutes between subsequent action executions
(applies to both `email_administrator` and `notify_pager` actions)
Expand Down Expand Up @@ -255,32 +259,33 @@ PUT _xpack/watcher/watch/log_event_watch
}
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]

<1> A `condition` that only applies to the `notify_pager` action, which
restricts its execution to when the condition succeeds (at least 5 hits in this case).

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/email.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/email.asciidoc
include::actions/email.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/webhook.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/webhook.asciidoc
include::actions/webhook.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/index.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/index.asciidoc
include::actions/index.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/logging.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/logging.asciidoc
include::actions/logging.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/hipchat.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/hipchat.asciidoc
include::actions/hipchat.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/slack.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/slack.asciidoc
include::actions/slack.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/pagerduty.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/pagerduty.asciidoc
include::actions/pagerduty.asciidoc[]

:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/x-pack/docs/en/watcher/actions/jira.asciidoc
:edit_url: https://github.com/elastic/elasticsearch/edit/{branch}/docs/reference/watcher/actions/jira.asciidoc
include::actions/jira.asciidoc[]

[float]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-email]]
=== Email Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-hipchat]]
=== HipChat Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-index]]
=== Index Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-jira]]
=== Jira Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-logging]]
=== Logging Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-pagerduty]]
=== PagerDuty Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-slack]]
=== Slack Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[actions-webhook]]
=== Webhook Action

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-ack-watch]]
=== Ack Watch API

Expand Down Expand Up @@ -83,6 +84,7 @@ watch definition when you call the <<watcher-api-get-watch, Get Watch API>>:
GET _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]

The action state of a newly-created watch is `awaits_successful_execution`:

Expand Down Expand Up @@ -229,6 +231,7 @@ comma-separated list of action ids:
POST _xpack/watcher/watch/my_watch/_ack/action1,action2
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]

To acknowledge all of the actions of a watch, simply omit the `actions`
parameter:
Expand All @@ -237,8 +240,13 @@ parameter:
--------------------------------------------------
POST _xpack/watcher/watch/my_watch/_ack
--------------------------------------------------
// TEST[s/^/POST _xpack\/watcher\/watch\/my_watch\/_execute\n{ "record_execution" : true }\n/]
// CONSOLE
// TEST[skip:non-compliant license]

////
//After testing is re-enabled:
// [s/^/POST _xpack\/watcher\/watch\/my_watch\/_execute\n{ "record_execution" : true }\n/]
////


The response looks like a get watch response, but only contains the status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-activate-watch]]
=== Activate Watch API

Expand Down Expand Up @@ -34,7 +35,7 @@ call the <<watcher-api-get-watch, Get Watch API>>:
GET _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_inactive_watch]
// TEST[skip:non-compliant license, setup my_inactive_watch]

[source,js]
--------------------------------------------------
Expand Down Expand Up @@ -65,7 +66,7 @@ You can activate the watch by executing the following API call:
PUT _xpack/watcher/watch/my_watch/_activate
--------------------------------------------------
// CONSOLE
// TEST[setup:my_inactive_watch]
// TEST[skip:non-compliant license, setup my_inactive_watch]

The new state of the watch is returned as part of its overall status:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-deactivate-watch]]
=== Deactivate Watch API

Expand Down Expand Up @@ -33,7 +34,7 @@ call the <<watcher-api-get-watch, Get Watch API>>:
GET _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

[source,js]
--------------------------------------------------
Expand Down Expand Up @@ -64,7 +65,7 @@ You can deactivate the watch by executing the following API call:
PUT _xpack/watcher/watch/my_watch/_deactivate
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

The new state of the watch is returned as part of its overall status:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-delete-watch]]
=== Delete Watch API

Expand Down Expand Up @@ -45,7 +46,7 @@ The following example deletes a watch with the `my-watch` id:
DELETE _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

Response:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-execute-watch]]
=== Execute Watch API

Expand Down Expand Up @@ -140,7 +141,7 @@ The following example executes the `my_watch` watch:
POST _xpack/watcher/watch/my_watch/_execute
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

The following example shows a comprehensive example of executing the `my-watch` watch:

Expand All @@ -163,7 +164,7 @@ POST _xpack/watcher/watch/my_watch/_execute
}
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]
<1> The triggered and schedule times are provided.
<2> The input as defined by the watch is ignored and instead the provided input
is used as the execution payload.
Expand Down Expand Up @@ -298,7 +299,7 @@ POST _xpack/watcher/watch/my_watch/_execute
}
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

You can also associate a single execution mode with all the actions in the watch
using `_all` as the action id:
Expand All @@ -313,7 +314,7 @@ POST _xpack/watcher/watch/my_watch/_execute
}
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

The following example shows how to execute a watch inline:

Expand Down Expand Up @@ -349,6 +350,7 @@ POST _xpack/watcher/watch/_execute
}
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]

All other settings for this API still apply when inlining a watch. In the
following snippet, while the inline watch defines a `compare` condition,
Expand Down Expand Up @@ -387,3 +389,4 @@ POST _xpack/watcher/watch/_execute
}
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-get-watch]]
=== Get Watch API

Expand Down Expand Up @@ -32,7 +33,7 @@ The following example gets a watch with `my-watch` id:
GET _xpack/watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
// TEST[skip:non-compliant license, setup my_active_watch]

Response:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-put-watch]]
=== Put Watch API

Expand Down Expand Up @@ -143,6 +144,7 @@ PUT _xpack/watcher/watch/my-watch
}
--------------------------------------------------
// CONSOLE
// TEST[skip:non-compliant license]

When you add a watch you can also define its initial
{xpack-ref}/how-watcher-works.html#watch-active-state[active state]. You do that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-start]]
=== Start API

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-stats]]
=== Stats API

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[role="xpack"]
[testenv="gold"]
[[watcher-api-stop]]
=== Stop API

Expand Down
Loading