Sommaire
ceprule.create
Description
object ceprule.create(object/array CEP rules)
This method allows you to create new CEP rules.
This method is only available to Super admin user type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object/array) CEP rules to create.
Additionally to the standard CEP properties, the method accepts the following parameters.
| Parameter | Type | Description |
|---|---|---|
| operations | array | CEP rule operations to create for the CEP rule. Parameter behavior: - required |
| filter | object | CEP rule filter object for the CEP rule. Parameter behavior: - required |
Return values
(object) Returns an object containing the IDs of the created
CEP rules under the cep_ruleids property. The order of the
returned IDs matches the order of the passed CEP rules.
Examples
Create a new CEP rule
Create a CEP rule using evaluation method AND/OR with one condition
and one window. By default, the rule will be enabled.
{
"jsonrpc": "2.0",
"method": "ceprule.create",
"params": {
"name": "Group events by cause",
"stop": "1",
"sortorder": "0",
"description": "",
"status": "0",
"window_type": "2",
"filter": {
"evaltype": "0",
"formula": "",
"conditions": [
{
"type": "3",
"operator": "2",
"event_name": "Printer",
"tag": "",
"tag_value": "",
"severity": "0",
"host_name": "",
"host_group_name": "",
"time_period": "",
"formulaid": ""
}
]
},
"window": {
"duration": "1d",
"capacity": "0",
"group_by_host_group": "0",
"group_by_host": "1",
"group_by_tags": "1",
"tags": [
"cause"
],
"event_count_tag": "",
"script": ""
},
"operations": []
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"cep_ruleids": [
"1"
]
},
"id": 1
}
See also
Source
CCepRule::create() in ui/include/classes/api/services/CCepRule.php.