Zabbix Documentation 2.0

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


Sidebar

manual:appendix:api:trigger:getobjects

trigger.getobjects

Description

array trigger.getobjects(object filter)

This method allows to retrieve triggers that match the given filter criteria.

Parameters

(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.
node string Name of the node the host group must belong to.

This will override the nodeids parameter.
nodeids string/array ID of the node the host group must belong to.

Return values

(array) Returns an array of objects with all properties.

Examples

Retrieving triggers by name

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
}

See also

Source

CTrigger::getObject() in frontends/php/api/classes/CTrigger.php.