-
Type:
Documentation task
-
Resolution: Fixed
-
Priority:
Trivial
-
Affects Version/s: 4.0.12
-
Component/s: Documentation (D)
-
None
-
Sprint 57 (Oct 2019), Sprint 58 (Nov 2019)
Please give our documentation page a sample on how to create an agent autoregistration rule (eventsource:2) through API.
Here is one sample I found working:
Add the device to host group 'Linux servers' when the hostname contains 'SRV' OR Metadata contains 'Linux'.
API call:
{
"jsonrpc": "2.0",
"method": "action.create",
"params": {
"name": "register linux",
"eventsource": "2",
"status": "0",
"def_shortdata": "custom subject",
"def_longdata": "custom message",
"filter": {
"evaltype": "2",
"formula": "A or B",
"conditions": [
{
"conditiontype": "22",
"operator": "2",
"value": "SRV",
"value2": "",
"formulaid": "B"
},
{
"conditiontype": "24",
"operator": "2",
"value": "CentOS",
"value2": "",
"formulaid": "A"
}
]
},
"operations": [
{
"actionid": "9",
"operationtype": "4",
"esc_period": "0",
"esc_step_from": "1",
"esc_step_to": "1",
"evaltype": "0",
"opgroup": [
{
"operationid": "16",
"groupid": "2"
}
]
}
]
},
"auth": "7ecc86b762f63fa19e5bfd71b83415fd",
"id": 1
}