Sidebar

Zabbix Summit 2022
Register for Zabbix Summit 2022

event.acknowledge

Description

描述

object event.acknowledge(object/array parameters) 对象 event.acknowledge(object/array parameters)

This method allows to update events. Following update actions can be performed:

  • Close event. If event is already resolved, this action will be skipped.
  • Acknowledge event. If event is already acknowledged, this action will be skipped.
  • Add message.
  • Change event severity. If event already has same severity, this action will be skipped.

此方法用于更新事件,可以执行以下更新操作:

  • 关闭事件. 如果事件已经解决,此操作将会被跳过.
  • 确认事件. 如果事件已经被确认,此操作将会被跳过.
  • 增加消息.
  • 更改事件严重等级. 如果事件已经拥有相同的严重等级,此操作将会被跳过.

Only trigger events can be updated.
Only problem events can be updated.
Read/Write rights for trigger are required to close the event or to change event's severity.
To close event, it should be allowed in trigger. ::: <note important>只有触发器事件可以被更新.
只有问题事件可以被更新.
关闭事件或者更改事件的严重等级需要具有对触发器的读写权限.
为了可以关闭事件,你应该在触发器中配置'允许手动关闭'.

Parameters

参数

(object/array) Parameters containing the IDs of the events and update operations that should be performed. (对象/数组) 包含事件ID和应执行的更新操作的参数.

Parameter Type Description
eventids
(required)
string/object IDs of the events to acknowledge.
action
(required)
integer Event update action(s). This is bitmask field, any combination of values are acceptable.

Possible values:
1 - close problem;
2 - acknowledge event;
4 - add message;
8 - change severity.
message string Text of the message.
Required, if action contains 'add message' flag.
severity integer New severity for events.
Required, if action contains 'change severity' flag.

Possible values:
0 - not classified;
1 - information;
2 - warning;
3 - average;
4 - high;
5 - disaster.
参数 类 描述
eventids
(必选)
string/object 确认事件的ID.
action
(必选)
integer
更新事件的操作. 这是位掩码字段,可接受以下任何值的组合.
可能值:
1 - 关闭问题;
2 - 确认事件;
4 - 增加消息;
8 - 更改严重等级.
message string 消息文本.
如果操作包含'增加消息'标志,此选项必选.
severity integer 事件的新的严重等级.
如果操作包含'更改严重等级'标志,此选项必选.

可能值:
0 - 未分类;
1 - 信息;
2 - 警告;
3 - 一般严重;
4 - 严重;
5 - 灾难.

Return values

返回值

(object) Returns an object containing the IDs of the updated events under the eventids property. (对象)eventids属性下,返回一个包含被更新事件的ID.

Examples

例子

Acknowledging an event

确认一个事件

Acknowledge a single event and leave a message. 确认一个事件并留下消息

Request: 请求:

{
           "jsonrpc": "2.0",
           "method": "event.acknowledge",
           "params": {
               "eventids": "20427",
               "action": 6,
               "message": "Problem resolved."
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response: 响应:

{
           "jsonrpc": "2.0",
           "result": {
               "eventids": [
                   "20427"
               ]
           },
           "id": 1
       }

Changing event's severity

更改事件的严重等级

Change multiple event's severity and leave a message. 更改多个事件的严重等级并留下消息.

Request: 请求:

{
           "jsonrpc": "2.0",
           "method": "event.acknowledge",
           "params": {
               "eventids": ["20427", "20428"],
               "action": 12,
               "message": "Maintenance required to fix it.",
               "severity": 4
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response: 响应:

{
           "jsonrpc": "2.0",
           "result": {
               "eventids": [
                   "20427",
                   "20428"
               ]
           },
           "id": 1
       }

Source

来源

CEvent::acknowledge() in frontends/php/include/classes/api/services/CEvent.php.