array trigger.getobjects(object filter)
This method allows to retrieve triggers that match the given filter criteria.
This method is deprecated and will be removed in the future. Please use trigger.get instead.
(object)
Criteria to search by.
Additionally to the standard standard trigger properties the following parameters are supported as search criteria.
Parameter | Type | Description |
---|---|---|
host | string/array | Technical name of the host that the trigger belongs to. |
hostid | string/array | ID of the host that the trigger belongs to. |
(array)
Returns an array of objects with all properties.
Retrieve triggers with the name "/etc/passwd has been changed on {HOST.NAME}" from two hosts.
Request:
{
"jsonrpc": "2.0",
"method": "trigger.getobjects",
"params": {
"description": "/etc/passwd has been changed on {HOST.NAME}",
"hostid": [
"30069",
"30049"
]
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"triggerid": "13938",
"expression": "{13385}>0",
"description": "/etc/passwd has been changed on {HOST.NAME}",
"url": "",
"status": "0",
"value": "0",
"priority": "2",
"lastchange": "0",
"comments": "",
"error": "Agent is unavailable.",
"templateid": "10016",
"type": "0",
"value_flags": "1",
"flags": "0"
},
{
"triggerid": "14062",
"expression": "{13513}>0",
"description": "/etc/passwd has been changed on {HOST.NAME}",
"url": "",
"status": "0",
"value": "0",
"priority": "2",
"lastchange": "0",
"comments": "",
"error": "",
"templateid": "10016",
"type": "0",
"value_flags": "0",
"flags": "0"
}
],
"id": 1
}
CTrigger::getObject() in frontends/php/include/classes/api/services/CTrigger.php.