Sidebar

2022 Zabbix中国峰会
2022 Zabbix中国峰会

correlation.update

Description 说明

object correlation.update(object/array correlations)

This method allows to update existing correlations.该方法允许更新现有的相关性。

Parameters参数

(object/array) Correlation properties to be updated.要更新的相关属性。

The correlationid property must be defined for each correlation, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.必须为每个关联定义“相关性”属性,所有其他属性都是可选的。只有超时的属性将被更新,所有其他属性将保持不变。

Additionally to the standard correlation properties, the method accepts the following parameters.除标准相关性外,该方法接受以下参数。

参数 类 说明
filter object Correlation filter object to replace the current filter.替换当前过滤器的关联过滤对象。
operations array Correlation operations to replace existing operations.替换现有操作的关联操作。

Return values返回值

(object) Returns an object containing the IDs of the updated correlations under the correlationids property.返回一个对象,该对象包含“相关性”属性下更新的相关性的ID。

Examples示例

Disable correlation禁用关联

Request:

{
           "jsonrpc": "2.0",
           "method": "correlation.update",
           "params": {
               "correlationid": "1",
               "status": "1"
           },
           "auth": "343baad4f88b4106b9b5961e77437688",
           "id": 1
       }

Response:

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

Replace conditions, but keep the evaluation method替换条件,但保持评估方法

Request:

{
           "jsonrpc": "2.0",
           "method": "correlation.update",
           "params": {
               "correlationid": "1",
               "filter": {
                   "conditions": [
                       {
                           "type": 3,
                           "oldtag": "error",
                           "newtag": "ok"
                       }
                   ]
               }
           },
           "auth": "343baad4f88b4106b9b5961e77437688",
           "id": 1
       }

Response:

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

See also参见

Source来源

CCorrelation::update() in frontends/php/include/classes/api/services/CCorrelation.php.