Skip to content

Commit a272b66

Browse files
Merge pull request #2685 from splunk/trangl-o11ydocs-6987-detectors-payload-new-fields
Add new variables and helper functions
2 parents 568aa3e + f946949 commit a272b66

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

alerts-detectors-notifications/alerts-and-detectors/alert-message-variables-reference.rst

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ Detector and rule details
4242
* - {{{detectorName}}}
4343
- The name of this detector
4444

45+
* - {{detectorId}}
46+
- The ID of this detector. You can use this to programmatically reference this detector.
47+
48+
* - {{detectorTags}}
49+
- List of all tags added to this detector, in the following format:
50+
``[tag1, tag2, ...]``
51+
52+
* - {{detectorTeams}}
53+
- List of all teams linked to this detector, in the following format:
54+
``[Team{id='E3lSp2ZAIAA', name='Team A'}, Team{id='GbsDUCCAEAI', name='Team B'}]``
55+
56+
* - {{detectorUrl}}
57+
- The URL of this detector
58+
4559
* - {{{ruleName}}}
4660
- The name of the rule that triggered the alert
4761

@@ -57,11 +71,7 @@ Detector and rule details
5771
* - {{{tip}}}
5872
- Plain text suggested first course of action, such as a command line to run.
5973

60-
* - {{detectorId}}
61-
- The ID of this detector. You can use this to programmatically reference this detector.
6274

63-
* - {{detectorUrl}}
64-
- The URL of this detector
6575

6676
Alert details
6777
-------------
@@ -148,18 +158,28 @@ Helper functions
148158

149159
.. list-table::
150160
:header-rows: 1
151-
:widths: 25 75
161+
:widths: 20 40 40
152162

153163
* - :strong:`Option`
154164
- :strong:`Description`
165+
- :strong:`Example`
155166

156-
* - {{#if}} {{else}} {{/if}}
157-
- Conditional, e.g.
158-
{{#if anomalous}}Alert triggered at {{timestamp}} {{else}} Alert cleared at {{timestamp}} {{/if}}
167+
* - {{#each}} {{/each}}
168+
- Iterate over items in a list. Use {{this}} to refer to the element being iterated over.
169+
- ``{{#each detectorTeams}} {{this}} {{/each}}``
170+
171+
* - {{#if}} {{else}} {{/if}}
172+
- Conditional
173+
- ``{{#if anomalous}} Alert triggered at {{timestamp}} {{else}} Alert cleared at {{timestamp}} {{/if}}``
159174

160175
* - {{#notEmpty dimensions}} {{/notEmpty}}
161-
- If there are dimensions associated with the signal, e.g.
162-
{{#notEmpty dimensions}} Signal details: {{{dimensions}}} {{/notEmpty}}
176+
- Check if there are dimensions associated with the signal
177+
- ``{{#notEmpty dimensions}} Signal details: {{{dimensions}}} {{/notEmpty}}``
178+
179+
* - {{#unless}} {{/unless}}
180+
- Conditional, an inverse of the {{if}} function
181+
- ``Teams: {{#each detectorTeams}} {{name}}{{#unless @last}}, {{/unless}}{{/each}}``
182+
163183

164184
.. _condition-variables:
165185

@@ -280,19 +300,14 @@ The following is an example of a default message that you can customize:
280300
.. code-block:: none
281301
282302
{{#if anomalous}}
283-
Rule "{{ruleName}}" in detector "{{detectorName}}" triggered at {{timestamp}}.
303+
Rule "{{{ruleName}}}" triggered at {{dateTimeFormat timestamp format="full"}}.
284304
{{else}}
285-
Rule "{{ruleName}}" in detector "{{detectorName}}" cleared at {{timestamp}}.
286-
{{/if}}
287-
288-
{{#if anomalous}}
289-
Triggering condition: {{{readableRule}}}
290-
{{/if}}
291-
292-
{{#if anomalous}}Signal value: {{inputs.A.value}}
293-
{{else}}Current signal value: {{inputs.A.value}}
305+
Rule "{{{ruleName}}}" cleared at {{dateTimeFormat timestamp format="full"}}.
294306
{{/if}}
295307
308+
{{#if anomalous}}Signal value for {{dimensions.app}} in {{dimensions.sf_environment}} is out of bounds
309+
{{else}}Current signal value for {{dimensions.app}} in {{dimensions.sf_environment}}{{/if}}
310+
296311
{{#notEmpty dimensions}}
297312
Signal details:
298313
{{{dimensions}}}
@@ -302,3 +317,8 @@ The following is an example of a default message that you can customize:
302317
{{#if runbookUrl}}Runbook: {{{runbookUrl}}}{{/if}}
303318
{{#if tip}}Tip: {{{tip}}}{{/if}}
304319
{{/if}}
320+
321+
{{#if detectorTags}}Tags: {{detectorTags}}{{/if}}
322+
{{#if detectorTeams}}
323+
Teams: {{#each detectorTeams}} {{name}}{{#unless @last}}, {{/unless}}{{/each}}.
324+
{{/if}}

0 commit comments

Comments
 (0)