[comment]: # ({7ba67424-526f6fc0})
# 2 动作

[comment]: # ({/7ba67424-526f6fc0})

[comment]: # ({15853a5c-b7a4d71e})
## 2 Actions

[comment]: # ({/15853a5c-b7a4d71e})

[comment]: # ({7b752485-0d5b3565})
#### 概述

#### Overview

如果您希望由于事件而发生某些操作（例如发送通知），则需要配置动作(actions)。

If you want some operations taking place as a result of events (for
example, notifications sent), you need to configure actions.

可以根据所有支持的类型的事件来定义操作：

Actions can be defined in response to events of all supported types:

-   触发事件 - 当trigger的状态从 *OK* 转到 *PROBLEM* 或者从 *PROBLEM*
    转到 *OK*
-   发现事件 - 发生网络发现时
-   自动注册事件 -当新的活动代理自动注册
-   内部事件 - 当项目不受支持或触发器进入未知状态

```{=html}
<!-- -->
```
-   Trigger events - when trigger status changes from *OK* to *PROBLEM*
    and back
-   Discovery events - when network discovery takes place
-   Auto registration events - when new active agents auto-register (or
    host metadata changes for registered ones)
-   Internal events - when items become unsupported or triggers go into
    an unknown state

#### 配置动作

#### Configuring an action

#### 配置动作

To configure an action, do the following:

-   进入 *配置 - >操作*
-   从*Event source*下拉单中选择所需的来源
-   点击 *创建 action*
-   命名action
-   选择进行操作的条件
-   选择[操作](/manual/config/notifications/action/operation)来执行
-   选择[恢复操作](/manual/config/notifications/action/recovery_operations)来执行

```{=html}
<!-- -->
```
-   Go to *Configuration → Actions*
-   From the *Event source* dropdown select the required source
-   Click on *Create action*
-   Name the action
-   Choose conditions upon which operations are carried out
-   Choose the
    [operations](/manual/config/notifications/action/operation) to carry
    out
-   Choose the [recovery
    operations](/manual/config/notifications/action/recovery_operations)
    to carry out

常见动作属性：

General action attributes:

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

All mandatory input fields are marked with a red asterisk.

|参数                    说|<|
|-----------------------------|-|
|*Name*|action名称.|
|*Type of calculation*|选择评估 [manual/config/notifications/action/conditions\#type\_of\_calculation选项](/manual/config/notifications/action/conditions#type_of_calculation选项) 作为行动条件（有多个条件）：<br>**And** - 必须满足所有条件<br>**Or** - 如果满足一个条件就足够了<br>**And/Or** - 两者的组合：AND与不同的条件类型和 OR具有相同的条件类型<br>**Custom expression** - 用于评估操作条件的用户定义的计算公式.|
|*Conditions*|行动条件清单。|
|*New condition*|选择一个新的动作[条件](/manual/config/notifications/action/conditions)并且点击*Add*.|
|*Enabled*|选中该复选框以启用该操作. 否则将被禁用.|

|Parameter|Description|
|---------|-----------|
|*Name*|Unique action name.|
|*Type of calculation*|Select the evaluation [option](/manual/config/notifications/action/conditions#type_of_calculation) for action conditions (with more than one condition):<br>**And** - all conditions must be met<br>**Or** - enough if one condition is met<br>**And/Or** - combination of the two: AND with different condition types and OR with the same condition type<br>**Custom expression** - a user-defined calculation formula for evaluating action conditions.|
|*Conditions*|List of action conditions.|
|*New condition*|Select a new action [condition](/manual/config/notifications/action/conditions) and click on *Add*.|
|*Enabled*|Mark the checkbox to enable the action. Otherwise it will be disabled.|

[comment]: # ({/7b752485-0d5b3565})
