Na tej stronie
ceprule.get
Description
integer/array ceprule.get(object parameters)
The method allows you to retrieve CEP rules according to the given parameters.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
Parameters
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| cep_ruleids | ID/array | Return only CEP rules with the given IDs. |
| selectFilter | query | Return a filter property with the CEP rule conditions. |
| selectOperations | query | Return an operations property with the CEP rule operations. |
| selectWindow | query | Return a [window](/manual/api/reference/ceprule/object#cep-rule-time-window) property with the CEP rule time window. |
| sortfield | string/array | Sort the result by the given properties. Possible values: cep_ruleid, name, stop, sortorder, status. |
| countOutput | boolean | These parameters are described in the reference commentary. |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
Return values
(integer/array) Returns either:
- an array of objects;
- the count of retrieved objects, if the
countOutputparameter has been used.
Examples
Retrieve CEP rules
Retrieve enabled CEP rules, including conditions, windows, and operations.
{
"jsonrpc": "2.0",
"method": "ceprule.get",
"params": {
"output": "extend",
"filter": {"status": 0},
"selectFilter": "extend",
"selectWindow": "extend",
"selectOperations": "extend"
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"cep_ruleid": "2",
"name": "Group events by cause",
"stop": "0",
"sortorder": "1",
"description": "",
"status": "0",
"window_type": "2",
"error": "",
"filter": {
"evaltype": "0",
"eval_formula": "A",
"formula": "",
"conditions": [
{
"type": "3",
"operator": "2",
"event_name": "Printer",
"tag": "",
"tag_value": "",
"severity": "0",
"host_name": "",
"host_group_name": "",
"time_period": "",
"formulaid": "A"
}
]
},
"window": {
"duration": "1d",
"capacity": "0",
"group_by_host_group": "0",
"group_by_host": "1",
"group_by_tags": "1",
"tags": [
"cause"
],
"event_count_tag": "symptoms",
"script": ""
},
"operations": []
},
{
"cep_ruleid": "10",
"name": "Suppress consecutive events",
"stop": "1",
"sortorder": "2",
"description": "",
"status": "0",
"window_type": "3",
"error": "",
"filter": {
"evaltype": "0",
"eval_formula": "A",
"formula": "",
"conditions": [
{
"type": "3",
"operator": "2",
"event_name": "Printer",
"tag": "",
"tag_value": "",
"severity": "0",
"host_name": "",
"host_group_name": "",
"time_period": "",
"formulaid": "A"
}
]
},
"window": {
"duration": "3m",
"capacity": "0",
"group_by_host_group": "0",
"group_by_host": "1",
"group_by_tags": "1",
"tags": [
"cause"
],
"event_count_tag": "",
"script": ""
},
"operations": [
{
"sortorder": "1",
"execute_when": "1",
"type": "7",
"event_name": "",
"severity": "0",
"suppress_duration": "6m",
"tag": "",
"new_tag": "",
"tag_value": "",
"scope": "0",
"filter": {
"evaltype": "0",
"eval_formula": "A",
"formula": "",
"conditions": [
{
"type": "33",
"operator": "10",
"tag": "",
"tag_value": "",
"formulaid": "A"
}
]
},
"scope_filter": {
"evaltype": "0",
"eval_formula": "",
"formula": "",
"conditions": []
}
},
{
"sortorder": "2",
"execute_when": "2",
"type": "8",
"event_name": "",
"severity": "0",
"suppress_duration": "0",
"tag": "",
"new_tag": "",
"tag_value": "",
"scope": "0",
"filter": {
"evaltype": "0",
"eval_formula": "A",
"formula": "",
"conditions": [
{
"type": "35",
"operator": "10",
"tag": "",
"tag_value": "",
"formulaid": "A"
}
]
},
"scope_filter": {
"evaltype": "0",
"eval_formula": "",
"formula": "",
"conditions": []
}
}
]
}
],
"id": 1
}
See also
Source
CCepRule::get() in ui/include/classes/api/services/CCepRule.php.