Sidebar

Zabbix Summit 2022
Register for Zabbix Summit 2022

Table of Contents

> Alert object

以下是 alert API 的使用方法

告警

Alerts 是由 Zabbix server 创建,无法通过 API 修改。

alert 对象包含有关某些 action 操作是否已成功执行的信息,它具有以下特性。

特性 类 描述
alertid string Alert ID 值。
actionid string Alert 生成的 Action ID.
alerttype integer Alert 类型。

可能的值:
0 - 信息;
1 - 远程命令。
clock timestamp Alert 生成的时间。
error string Alert 发送信息或者执行一个命令产生的报错信息。
esc_step integer 生成 Alert 后 Action 的处理步骤。
eventid string 触发 Action 的事件 ID。
mediatypeid string 用于发送消息的报警媒介类型的 ID。
message text 消息文本。用于消息告警。
retries integer Zabbix 尝试发送消息的次数。
sendto string 地址,用户名或接收者的其他标识符。用于消息告警。
status integer 显示 action 操作是否已执行成功的状态。

消息告警的可能值:
0 - 消息未发送。
1 - 消息已发送。
2 - 经多次重试后失败。
3 - action 管理器尚未处理新警报。

命令告警的可能值:
0 - 命令没有运行。
1 - 命令运行成功。
2 - 尝试在 Zabbix agent 上运行命令但不可用。
subject string 消息主题。用于消息告警。
userid string 邮件发送到的用户的 ID。
p_eventid string 生成告警的异常事件 ID。
acknowledgeid string 生成告警的确认 ID。

The following objects are directly related to the alert API.

Alert

Alerts are created by the Zabbix server and cannot be modified via the API.

The alert object contains information about whether certain action operations have been executed successfully. It has the following properties.

Property Type Description
alertid string ID of the alert.
actionid string ID of the action that generated the alert.
alerttype integer Alert type.

Possible values:
0 - message;
1 - remote command.
clock timestamp Time when the alert was generated.
error string Error text if there are problems sending a message or running a command.
esc_step integer Action escalation step during which the alert was generated.
eventid string ID of the event that triggered the action.
mediatypeid string ID of the media type that was used to send the message.
message text Message text. Used for message alerts.
retries integer Number of times Zabbix tried to send the message.
sendto string Address, user name or other identifier of the recipient. Used for message alerts.
status integer Status indicating whether the action operation has been executed successfully.

Possible values for message alerts:
0 - message not sent.
1 - message sent.
2 - failed after a number of retries.
3 - new alert is not yet processed by alert manager.

Possible values for command alerts:
0 - command not run.
1 - command run.
2 - tried to run the command on the Zabbix agent but it was unavailable.
subject string Message subject. Used for message alerts.
userid string ID of the user that the message was sent to.
p_eventid string ID of problem event, which generated the alert.
acknowledgeid string ID of acknowledgement, which generated the alert.