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

correlation.get

Description

integer/array correlation.get(object parameters)

The method allows to retrieve correlations according to the given parameters.该方法允许根据给定的参数获取关联。

Parameters 参数

(object) Parameters defining the desired output.定义所需输出的参数。

The method supports the following parameters.该方法支持以下参数。

参数 类 描述
correlationids string/array Return only correlations with the given IDs. 仅返回给定ID的关联。
selectFilter query Returns the correlation filter in the filter property.返回“filter”属性中的关联过滤器。
selectOperations query Return correlation operations in the operations property. 返回“操作”属性中的关联操作。
sortfield string/array Sort the result by the given properties.按照给定的属性对结果进行排序

Possible values are: correlationid, name and status. 可能的值有:correlationidnamestatus
countOutput flag These parameters being common for all get methods are described in the reference commentary. 这些参数对于所有的“get”方法都是常见的,在参考文献中有描述
editable boolean
excludeSearch flag
filter object
limit integer
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

Return values 返回值

(integer/array) Returns either:返回;

  • an array of objects;一组对象;
  • the count of retrieved objects, if the countOutput parameter has been used.如果已经使用“countOutput”参数,则检索到的对象的计数。

Examples 示例

Retrieve correlations获取关联

Retrieve all configured correlations together with correlation conditions and operations. The filter uses the "and/or" evaluation type, so the formula property is empty and eval_formula is generated automatically.获取所有配置的关联以及关联条件和操作。过滤器使用“和/或”评估类型,因此formula属性为空,“eval_formula”是自动生成的。

Request:

{
           "jsonrpc": "2.0",
           "method": "correlation.get",
           "params": {
               "output": "extend",
               "selectOperations": "extend",
               "selectFilter": "extend"
           },
           "auth": "343baad4f88b4106b9b5961e77437688",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "correlationid": "1",
                   "name": "Correlation 1",
                   "description": "",
                   "status": "0",
                   "filter": {
                       "evaltype": "0",
                       "formula": "",
                       "conditions": [
                           {
                               "type": "3",
                               "oldtag": "error",
                               "newtag": "ok",
                               "formulaid": "A"
                           }
                       ],
                       "eval_formula": "A"
                   },
                   "operations": [
                       {
                           "type": "0"
                       }
                   ]
               }
           ],
           "id": 1
       }

See also 参见

Source 来源

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