Creating a Trigger Using the Expression Editor
The Create New Trigger screen allows you to use a graphical editor to build the JSON string that defines a trigger. You can use the expression editor section to build the tsquery statement, or you can edit the tsquery statement manually. Triggers use the tsquery language to create trigger expressions.
- Go to a service, role, role configuration group, or host
configuration page and click the Create Trigger
button next to the Health Test section.
The Create New Trigger screen displays.
As you build the trigger, the actual query text displays to the right, along with a preview of a chart returned by the query.
- Enter a name for the trigger in the Name field.
- Build the metric expressions:
- Select the function to use in your expression, either Last, Min, or Max.
- Select the metric by typing its name in the Metric field. A list of available metrics displays as you type.
- Select the operator, either >, >=, =, <, or <=.
- Enter the value to use for the comparison in the Value field.
- (Optional) Click the + icon to add additional expressions. Additional expressions are added to the query using the logical operator AND.
- (Optional) Create a predicate for the query. Under
Attribute Conditions, click the
+ icon to add an attribute condition.
A set of fields displays that you use to build an expression for the predicate.
- Type the attribute name in the Attribute field. A list of attributes displays as you type.
- Select the operator, either = or RLIKE.
- Enter the value for the comparison in the Value field.
- (Optional) Click the + icon to add additional expressions. Additional expressions are added to the predicate using the logical operator AND.
- Select an Action from the drop-down menu
to define the action taken when the trigger fires:
- Mark as bad (red)
- Mark as concerning (yellow)
- Enter a value for the Stream Threshold. Leave the value set
0to include all streams; enter an integer to set the number of streams required to meet the condition.
- Select Enabled to enable the trigger. If you disable the trigger, it does not run.
- (Optional) Select Suppressed. A suppressed trigger still runs but does not impact the health display of the owning entity.
- Verify your expression:
In the area to the right of the expression builder, in the Preview section, the expression you have built displays. A chart also displays the result of the query. Click Show Filtered Streams to see all streams. Click Hide Filtered Streams to hide streams that do not meet the stream threshold.You can edit your trigger using the fields in the expression builder, or you can click the Edit Manually link to display a text box in which you can manually edit the trigger. Click Use Editor to return to the expression builder.
- Click Create Trigger to save your trigger.