alerting-kibana-plugin
alerting-kibana-plugin copied to clipboard
Document the fields available in ctx for trigger actions
In the documentation: https://opendistro.github.io/for-elasticsearch-docs/docs/alerting/monitors/#add-actions
How do I know which fields I have available in ctx? I gather I have some or all of the monitor, trigger, and period. What other fields are there?
The UI includes an "info" button which is not helpful:
Hi @Jon-AtAWS , it's actually in the area you linked.
You can add variables to your messages using Mustache templates. You have access to
ctx.action.name
, the name of the current action, as well as all trigger variables.
I failed at manual-reading in middle school. It's been a burden ever since ;-)
Will move this to kibana-alerting repository since we can still make the UI info popout more informative :)
@dbbaughe are you think we could support some kind of typeahead functionality to make the info pop out more or something else?
@elfisher That would be nice :), but was just suggesting we add the documentation that Andrew mentioned into the UI in that popout window.
@dbbaughe got it. That makes sense. A pop out with those docs would be nice :)
There's a popout now, so let's close this issue.
How can i access a variable defined in Trigger and later use in Actions. This variable is a custom variable defined in trigger.
for example trigger condition is
int ok = 20; int cr = 57; String state = 'TEMP'; if(cr > ctx.results[0].hits.total.value && ctx.results[0].hits.total.value > ok) {state='WARNING'; return true} if( ctx.results[0].hits.total.value > cr) {state='CRITICAL'; return true} if( ctx.results[0].hits.total.value < ok) {return false}
and now i would like to use the state in my actions, how can i use this?
{{state}} Alert
in message does not work, any ideas on how to make this work?