correlation.create

Description 说明

object correlation.create(object/array correlations)

This method allows to create new correlations.该方法允许创建新的关联

Parameters 参数

(object/array) Correlations to create.关联创建。

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

参数 类 说明
operations
(required)
array Correlation operations to create for the correlation.创建关联的关联操作
filter
(required)
object Correlation filter object for the correlation. 关联的关联过滤对象

Return values 返回值

(object) Returns an object containing the IDs of the created correlations under the correlationids property. The order of the returned IDs matches the order of the passed correlations.返回一个对象,该对象包含“相关性”属性下创建的关联的ID。返回的ID的顺序与通过的相关性的顺序相匹配。

Examples 例子

Create a new event tag correlation创建一个新的事件标签关联

Create a correlation using evaluation method AND/OR with one condition and one operation. By default the correlation will be enabled.使用评估方法“AND / OR”创建一个相关性,具有一个条件和一个操作。默认情况下,关联将被启用。

Request:

{
           "jsonrpc": "2.0",
           "method": "correlation.create",
           "params": {
               "name": "new event tag correlation",
               "filter": {
                   "evaltype": 0,
                   "conditions": [
                       {
                           "type": 1,
                           "tag": "ok"
                       }
                   ]
               },
               "operations": [
                   {
                       "type": 0
                   }
               ]
           },
           "auth": "343baad4f88b4106b9b5961e77437688",
           "id": 1
       }

Response:

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

Using a custom expression filter使用自定义表达式过滤器

Create a correlation that will use a custom filter condition. The formula IDs "A" or "B" have been chosen arbitrarily. Condition type will be "Host group" with operator "<>".创建一个使用自定义过滤条件的关联。公式ID“A”或“B”已被任意选择。条件类型将为“主机组”与操作员

Request:

{
           "jsonrpc": "2.0",
           "method": "correlation.create",
           "params": {
               "name": "new host group correlation",
               "description": "a custom description",
               "status": 0,
               "filter": {
                   "evaltype": 3,
                   "formula": "A or B",
                   "conditions": [
                       {
                           "type": 2,
                           "operator": 1,
                           "formulaid": "A"
                       },
                       {
                           "type": 2,
                           "operator": 1,
                           "formulaid": "B"
                       }
                   ]
               },
               "operations": [
                   {
                       "type": 1
                   }
               ]
           },
           "auth": "343baad4f88b4106b9b5961e77437688",
           "id": 1
       }

Response:

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

See also参见

Source来源

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