Skip to content

[DOCS] Updates Watcher examples for code testing #31152

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

Merged
merged 2 commits into from
Jun 23, 2018
Merged
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
32 changes: 0 additions & 32 deletions x-pack/docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,6 @@ buildRestTests.expectedUnconvertedCandidates = [
'en/security/authorization/run-as-privilege.asciidoc',
'en/security/ccs-clients-integrations/http.asciidoc',
'en/security/authorization/custom-roles-provider.asciidoc',
'en/watcher/actions/email.asciidoc',
'en/watcher/actions/hipchat.asciidoc',
'en/watcher/actions/index.asciidoc',
'en/watcher/actions/logging.asciidoc',
'en/watcher/actions/pagerduty.asciidoc',
'en/watcher/actions/slack.asciidoc',
'en/watcher/actions/jira.asciidoc',
'en/watcher/actions/webhook.asciidoc',
'en/watcher/condition/always.asciidoc',
'en/watcher/condition/array-compare.asciidoc',
'en/watcher/condition/compare.asciidoc',
'en/watcher/condition/never.asciidoc',
'en/watcher/condition/script.asciidoc',
'en/watcher/customizing-watches.asciidoc',
'en/watcher/example-watches/example-watch-meetupdata.asciidoc',
'en/watcher/how-watcher-works.asciidoc',
'en/watcher/input/chain.asciidoc',
'en/watcher/input/http.asciidoc',
'en/watcher/input/search.asciidoc',
'en/watcher/input/simple.asciidoc',
'en/watcher/transform.asciidoc',
'en/watcher/transform/chain.asciidoc',
'en/watcher/transform/script.asciidoc',
'en/watcher/transform/search.asciidoc',
'en/watcher/trigger/schedule/cron.asciidoc',
'en/watcher/trigger/schedule/daily.asciidoc',
'en/watcher/trigger/schedule/hourly.asciidoc',
'en/watcher/trigger/schedule/interval.asciidoc',
'en/watcher/trigger/schedule/monthly.asciidoc',
'en/watcher/trigger/schedule/weekly.asciidoc',
'en/watcher/trigger/schedule/yearly.asciidoc',
'en/watcher/troubleshooting.asciidoc',
'en/rest-api/ml/delete-snapshot.asciidoc',
'en/rest-api/ml/get-bucket.asciidoc',
'en/rest-api/ml/get-job-stats.asciidoc',
Expand Down
7 changes: 4 additions & 3 deletions x-pack/docs/en/watcher/actions/email.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ the watch payload in the email body:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The id of the action.
<2> The action type is set to `email`.
<3> One or more addresses to send the email to. Must be specified in the
Expand Down Expand Up @@ -92,6 +93,7 @@ killed by firewalls or load balancers inbetween.
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The ID of the attachment, which is used as the file name in the email
attachment.
<2> The type of the attachment and its specific configuration.
Expand Down Expand Up @@ -158,9 +160,8 @@ include::{kib-repo-dir}/reporting/watch-example.asciidoc[]

include::{kib-repo-dir}/reporting/report-intervals.asciidoc[]

//TODO: RE-ADD LINK:
//For more information, see
//{kibana-ref}/automating-report-generation.html[Automating Report Generation].
For more information, see
{kibana-ref}/automating-report-generation.html[Automating Report Generation].

[[email-action-attributes]]
==== Email Action Attributes
Expand Down
4 changes: 3 additions & 1 deletion x-pack/docs/en/watcher/actions/hipchat.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ attribute is the message itself:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The name of a HipChat account configured in `elasticsearch.yml`.
<2> The message you want to send to HipChat.

Expand Down Expand Up @@ -66,6 +67,7 @@ For example, the following action is configured to send messages to the
}
}
--------------------------------------------------
// NOTCONSOLE

To send messages with a HipChat account that uses the <<hipchat-api-v1, v1>>
profile, you need to specify what room or rooms you want to send the message to.
Expand All @@ -92,7 +94,7 @@ For example, the following action is configured to send messages to the
}
}
--------------------------------------------------

// NOTCONSOLE

[[hipchat-action-attributes]]
==== HipChat Action Attributes
Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/actions/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The following snippet shows a simple `index` action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The id of the action
<2> An optional <<condition, condition>> to restrict action execution
<3> An optional <<transform, transform>> to transform the payload and prepare the data that should be indexed
Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/actions/jira.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The following snippet shows a simple jira action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The name of a Jira account configured in `elasticsearch.yml`.
<2> The key of the Jira project in which the issue will be created.
<3> The name of the issue type.
Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/actions/logging.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following snippet shows a simple logging action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The id of the action.
<2> An optional <<transform, transform>> to transform the payload before
executing the `logging` action.
Expand Down
2 changes: 2 additions & 0 deletions x-pack/docs/en/watcher/actions/pagerduty.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following snippet shows a simple PagerDuty action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> Description of the message


Expand Down Expand Up @@ -59,6 +60,7 @@ payload as well as an array of contexts to the action.
}
}
--------------------------------------------------
// NOTCONSOLE


[[pagerduty-action-attributes]]
Expand Down
3 changes: 3 additions & 0 deletions x-pack/docs/en/watcher/actions/slack.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The following snippet shows a simple slack action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The channels and users you want to send the message to.
<2> The content of the message.

Expand Down Expand Up @@ -66,6 +67,7 @@ The following snippet shows a standard message attachment:
}
}
--------------------------------------------------
// NOTCONSOLE

[[slack-dynamic-attachment]]

Expand Down Expand Up @@ -131,6 +133,7 @@ aggregation and the Slack action:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The list generated by the action's transform.
<2> The parameter placeholders refer to attributes in each item of the list
generated by the transform.
Expand Down
4 changes: 4 additions & 0 deletions x-pack/docs/en/watcher/actions/webhook.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The following snippet shows a simple webhook action definition:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The id of the action
<2> An optional <<transform, transform>> to transform the payload before
executing the `webhook` action
Expand Down Expand Up @@ -65,6 +66,7 @@ For example, the following `webhook` action creates a new issue in GitHub:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The username and password for the user creating the issue

NOTE: By default, both the username and the password are stored in the `.watches`
Expand Down Expand Up @@ -101,6 +103,7 @@ the values serve as the parameter values:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The parameter values can contain templated strings.


Expand Down Expand Up @@ -128,6 +131,7 @@ the values serve as the header values:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The header values can contain templated strings.


Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/condition/always.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ object:
"always" : {}
}
--------------------------------------------------
// NOTCONSOLE
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/condition/array-compare.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ than or equal to 25:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The path to the array in the execution
context that you want to evaluate, specified in dot notation.
<2> The path to the field in each array element that you want to evaluate.
Expand Down
3 changes: 3 additions & 0 deletions x-pack/docs/en/watcher/condition/compare.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ search result>> is greater than or equal to 5:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> Use dot notation to reference a value in the execution context.
<2> Specify a comparison operator and the value you want to compare against.

Expand All @@ -68,6 +69,7 @@ of the form `<{expression}>`. For example, the following expression returns
}
}
--------------------------------------------------
// NOTCONSOLE

You can also compare two values in the execution context by specifying the
compared value as a path of the form of `{{path}}`. For example, the following
Expand All @@ -85,6 +87,7 @@ to the `ctx.payload.aggregations.handled.buckets.true.doc_count`:
}
}
--------------------------------------------------
// NOTCONSOLE

==== Accessing Values in the Execution Context

Expand Down
1 change: 1 addition & 0 deletions x-pack/docs/en/watcher/condition/never.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ you specify the condition type and associate it with an empty object:
"never" : {}
}
--------------------------------------------------
// NOTCONSOLE
7 changes: 7 additions & 0 deletions x-pack/docs/en/watcher/condition/script.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The following snippet configures an inline `script` condition that always return
"script" : "return true"
}
--------------------------------------------------
// NOTCONSOLE

This example defines a script as a simple string. This format is actually a
shortcut for defining an <<condition-script-inline, inline>> script. The
Expand All @@ -43,6 +44,7 @@ parameter, `result`:
}
}
--------------------------------------------------
// NOTCONSOLE

[[condition-script-inline]]
==== Inline Scripts
Expand All @@ -59,6 +61,7 @@ always returns `true`.
}
}
--------------------------------------------------
// NOTCONSOLE

[[condition-script-stored]]
==== Stored Scripts
Expand All @@ -74,6 +77,7 @@ in Elasticsearch. The following snippet shows how to refer to a script by its `i
}
}
--------------------------------------------------
// NOTCONSOLE

As with <<condition-script-inline, Inline>>
scripts, you can also specify the script language and parameters:
Expand All @@ -88,6 +92,7 @@ scripts, you can also specify the script language and parameters:
}
}
--------------------------------------------------
// NOTCONSOLE

[[accessing-watch-payload]]
==== Accessing the Watch Payload
Expand Down Expand Up @@ -121,6 +126,7 @@ threshold:
}
}
--------------------------------------------------
// NOTCONSOLE

When you're using a scripted condition to evaluate an Elasticsearch response,
keep in mind that the fields in the response are no longer in their native data
Expand All @@ -132,6 +138,7 @@ you need to parse the `@timestamp` string into a `DateTime`. For example:
--------------------------------------------------
org.elasticsearch.common.joda.time.DateTime.parse(@timestamp)
--------------------------------------------------
// NOTCONSOLE

You can reference the following variables in the watch context:

Expand Down
10 changes: 7 additions & 3 deletions x-pack/docs/en/watcher/customizing-watches.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fields in the payload:
}
}
-------------------------------------
// NOTCONSOLE

See <<input-simple>> for more details.

Expand Down Expand Up @@ -74,6 +75,7 @@ For example, the following `search` input loads the latest VIX quote:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> Will resolve to today's daily quotes index

See <<input-search>> for more details.
Expand Down Expand Up @@ -105,7 +107,7 @@ Amsterdam using http://openweathermap.org/appid[OpenWeatherMap] online service:
}
}
--------------------------------------------------

// NOTCONSOLE
See <<input-http>> for more details.

[[chaining-inputs]]
Expand Down Expand Up @@ -146,7 +148,7 @@ returned any hits:
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
},
--------------------------------------------------

// NOTCONSOLE
See <<condition-compare>> for more details.

==== Powerful Comparison Logic with the Script Condition
Expand Down Expand Up @@ -176,7 +178,7 @@ VIX quote loaded by the `http` input is either greater than 5% or lower than -5%
}
}
--------------------------------------------------

// NOTCONSOLE
See <<condition-script>> for more details.

[[using-transforms]]
Expand Down Expand Up @@ -231,6 +233,7 @@ attaches the payload data to the message:
}
}
--------------------------------------------------
// NOTCONSOLE
<1> The id of the action
<2> The action type, in this case it's an `email` action

Expand Down Expand Up @@ -261,6 +264,7 @@ creates a new issue in GitHub
}
}
--------------------------------------------------
// NOTCONSOLE
<1> `<owner>` is the owner of the GitHub repo and `<repo>` is the name of the repo.
<2> The username that creates the issue
<3> The password of that user
Expand Down
Loading