# 1 Configuring a trigger

#### Overview

To configure a trigger, do the following:

-   Go to: *Configuration* → *Hosts*
-   Click on *Triggers* in the row of the host
-   Click on *Create trigger* to the right (or on the trigger name to
    edit an existing trigger)
-   Enter parameters of the trigger in the form

#### Configuration

The **Trigger** tab contains all the essential trigger attributes.

![](../../../../assets/en/manual/config/triggers/trigger_a0.png)

All mandatory input fields are marked with a red asterisk.

|Parameter|Description|
|---------|-----------|
|*Name*|Trigger name.<br>The name may contain the supported [macros](/manual/appendix/macros/supported_by_location): `{HOST.HOST}, {HOST.NAME}, {HOST.CONN}, {HOST.DNS}, {HOST.IP}, {ITEM.VALUE}, {ITEM.LASTVALUE}` and `{$MACRO}`.<br>**$1, $2...$9** macros can be used to refer to the first, second...ninth constant of the expression.<br>*Note*: $1-$9 macros will resolve correctly if referring to constants in relatively simple, straightforward expressions. For example, the name "Processor load above $1 on {HOST.NAME}" will automatically change to "Processor load above 5 on New host" if the expression is {New host:system.cpu.load\[percpu,avg1\].last()}>5|
|*Severity*|Set the required trigger [severity](severity) by clicking the buttons.|
|*Expression*|Logical [expression](expression) used to define the conditions of a problem.<br>A problem is created after all the conditions included in the expression are met, i.e. the expression evaluates to TRUE. The problem will be resolved as soon as the expression evaluates to FALSE, unless additional recovery conditions are specified in *Recovery expression*.|
|*OK event generation*|OK event generation options:<br>**Expression** - OK events are generated based on the same expression as problem events;<br>**Recovery expression** - OK events are generated if the problem expression evaluates to FALSE and the recovery expression evaluates to TRUE;<br>**None** - in this case the trigger will never return to an OK state on its own.<br>Supported since Zabbix 3.2.0.|
|*Recovery expression*|Logical [expression](expression) (optional) defining additional conditions that have to be met before the problem is resolved, after the original problem expression has already been evaluated as FALSE.<br>Recovery expression is useful for trigger [hysteresis](/manual/config/triggers/expression#hysteresis). It is **not** possible to resolve a problem by recovery expression alone if the problem expression is still TRUE.<br>This field is only available if 'Recovery expression' is selected for *OK event generation*.<br>Supported since Zabbix 3.2.0.|
|*PROBLEM event generation mode*|Mode for generating problem events:<br>**Single** - a single event is generated when a trigger goes into the 'Problem' state for the first time;<br>**Multiple** - an event is generated upon *every* 'Problem' evaluation of the trigger.|
|*OK event closes*|Select if OK event closes:<br>**All problems** - all problems of this trigger<br>**All problems if tag values match** - only those trigger problems with matching event tag values<br>Supported since Zabbix 3.2.0.|
|*Tag for matching*|Enter event tag name to use for event correlation.<br>This field is displayed if 'All problems if tag values match' is selected for the *OK event closes* property and is mandatory in this case.<br>Supported since Zabbix 3.2.0.|
|*Allow manual close*|Check to allow [manual closing](/manual/config/events/manual_close) of problem events generated by this trigger. Manual closing is possible when acknowledging problem events.<br>Supported since Zabbix 3.2.0.|
|*URL*|If not empty, the URL entered here is available as a link in several frontend locations, e.g. when clicking on the problem name in *Monitoring → Problems* (*URL* option in the *Trigger* menu) and *Problems* dashboard widget.<br>Supported macros: {ITEM.VALUE}, {ITEM.LASTVALUE}, {TRIGGER.ID}, several [{HOST.\*}](/manual/appendix/macros/supported_by_location) macros, user macros.|
|*Description*|Text field used to provide more information about this trigger. May contain instructions for fixing specific problem, contact detail of responsible staff, etc.<br>*Starting with Zabbix 2.2*, the description may contain the same set of macros as trigger name.|
|*Enabled*|Unchecking this box will disable the trigger if required.|

The **Tags** tab allows you to define trigger-level
[tags](/manual/config/event_correlation/trigger/event_tags). All
problems of this trigger will be tagged with the values entered here.

![](../../../../assets/en/manual/config/triggers/trigger_b0.png){width="600"}

In addition the *Inherited and trigger tags* option allows to view tags
defined on template level, if the trigger comes from that template. If
there are multiple templates with the same tag, these tags are displayed
once and template names are separated with commas. A trigger does not
"inherit" and display host-level tags.

|Parameter|Description|
|---------|-----------|
|*Name/Value*|Set custom tags to mark trigger events.<br>Tags are a pair of tag name and value. You can use only the name or pair it with a value.<br>User macros, user macro context, low-level discovery macros and macro [functions](/manual/config/macros/macro_functions) with `{{ITEM.VALUE}}`, `{{ITEM.LASTVALUE}}` and low-level discovery macros are supported in event tags. Low-level discovery macros can be used inside macro context<br>{TRIGGER.ID} macro is supported in trigger tag values since Zabbix 4.2.8. It may be useful for identifying triggers created from trigger prototypes and, for example, suppressing problems from these triggers during maintenance.<br>If the total length of expanded value exceeds 255, it will be cut to 255 characters.<br>See all [macros](/manual/config/event_correlation/trigger/event_tags#macro_support) supported for event tags.<br>[Event tags](/manual/config/event_correlation/trigger/event_tags) can be used for event correlation, in action conditions and will also be seen in *Monitoring* → *Problems* or the *Problems* widget.<br>Supported since Zabbix 3.2.0.|

The **Dependencies** tab contains all the [dependencies](dependencies)
of the trigger.

Click on *Add* to add a new dependency.

::: noteclassic
You can also configure a trigger by opening an existing one,
pressing the *Clone* button and then saving under a different
name.
:::

#### Testing expressions

It is possible to test the configured trigger expression as to what the
expression result would be depending on the received value.

Following expression from an official template is taken as an example:

    {Template Net Cisco IOS SNMPv2:sensor.temp.value[ciscoEnvMonTemperatureValue.{#SNMPINDEX}].avg(5m)}>{$TEMP_WARN}
    or
    {Template Net Cisco IOS SNMPv2:sensor.temp.status[ciscoEnvMonTemperatureState.{#SNMPINDEX}].last(0)}={$TEMP_WARN_STATUS}

To test the expression, click on *Expression constructor* under the
expression field.

![](../../../../assets/en/manual/config/triggers/expr_constructor_link_new.png)

In the Expression constructor, all individual expressions are listed. To
open the testing window, click on *Test* below the expression list.

![](../../../../assets/en/manual/config/triggers/expr_constructor_test_new.png)

In the testing window you can enter sample values ("80, 70, 0, 1" in
this example) and then see the expression result, by clicking on the
*Test* button.

![](../../../../assets/en/manual/config/triggers/expression_test_new.png){width="600"}

The result of the individual expressions as well as the whole expression
can be seen.

"TRUE" result means the specified expression is correct. In this
particular case A, "80" is greater than {$TEMP\_WARN} specified value,
"70" in this example. Respectively, "TRUE" result appears.

"FALSE" result means the specified expression is incorrect. In this
particular case B, {$TEMP\_WARN\_STATUS}, "1" in this example, needs to
be equal with specified "0" value, that is wrong. Respectively, "FALSE"
result appears.

Chosen Expression type is "OR"/"TRUE". If at least one of the specified
conditions (A or B in this case) is TRUE, overall result will be TRUE as
well. That means, current value exceeds the warning value and a Problem
has occurred.
