Zabbix Documentation 2.0

3.04.04.24.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.4Guidelines

User Tools

Site Tools


Sidebar

manual:appendix:api:triggerprototype:get

triggerprototype.get

Description

integer/array triggerprototype.get(object parameters)

The method allows to retrieve trigger prototypes according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
active flag Return only enabled trigger prototypes that belong to monitored hosts.
applicationids string/array Return only trigger prototypes that contain items from the given applications.
discoveryids string/array Return only trigger prototypes that belong to the given LLD rules.
functions string/array Return only triggers that use the given functions.

Refer to the supported trigger functions page for a list of supported functions.
group string Return only trigger prototypes that belong to hosts from the host groups with the given name.
groupids string/array Return only trigger prototypes that belong to hosts from the given host groups.
host string Return only trigger prototypes that belong to hosts with the given name.
hostids string/array Return only trigger prototypes that belong to the given hosts.
inherited boolean If set to true return only trigger prototypes inherited from a template.
maintenance boolean If set to true return only enabled trigger prototypes that belong to hosts in maintenance.
min_severity integer Return only trigger prototypes with severity greater or equal than the given severity.
monitored flag Return only enabled trigger prototypes that belong to monitored hosts and contain only enabled items.
templated boolean If set to true return only trigger prototypes that belong to templates.
templateids string/array Return only trigger prototypes that belong to the given templates.
triggerids string/array Return only trigger prototypes with the given IDs.
expandData flag Return additional data about the first host in the trigger expression.

Adds the following properties to each trigger prototype:
hostname - (string) visible name of the host;
host - (string) technical name of the host;
hostid - (string) ID of the host.
expandExpression flag (added in 2.0.3) Expand functions and macros in the trigger expression.
selectDiscoveryRule query Return the LLD rule that the trigger prototype belongs to.

Does not support shorten.
selectFunctions query Return functions used in the trigger prototype in the functions property.

The function objects represents the functions used in the trigger expression and has the following properties:
functionid - (string) ID of the function;
itemid - (string) ID of the item used in the function;
function - (string) name of the function;
parameter - (string) parameter passed to the function.

Does not support shorten or arrays of properties.
selectGroups query Return the host groups that the trigger prototype belongs to in the groups property.

Does not support shorten or arrays of properties.
selectHosts query Return the hosts that the trigger prototype belongs to in the hosts property.

Does not support shorten.
selectItems query Return items and item prototypes used the trigger prototype in the items property.

Does not support shorten.
filter object Return only those results that exactly match the given filter.

Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against.

Supports additional filters:
host - technical name of the host that the trigger prototype belongs to;
hostid - ID of the host that the trigger prototype belongs to.
limitSelects integer Limits the number of records returned by subselects.

Applies to the following subselects:
selectHosts - results will be sorted by host.
sortfield string/array Sort the result by the given properties.

Possible values are: triggerid, description, status and priority.
countOutput flagThese parameters being common for all get methods are described in detail on the Generic Zabbix API information page.
editable boolean
excludeSearch flag
limit integer
nodeids string/array
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

Return values

(integer/array) Returns either:

  • an array of objects;
  • the count of retrieved objects, if the countOutput parameter has been used.

Examples

Retrieve trigger prototypes from an LLD rule

Retrieve all trigger prototypes and their functions from an LLD rule.

Request:

{
    "jsonrpc": "2.0",
    "method": "triggerprototype.get",
    "params": {
        "output": "extend",
        "selectFunctions": "extend",
        "discoveryids": "22450"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "functions": [
                {
                    "functionid": "12598",
                    "itemid": "22454",
                    "function": "last",
                    "parameter": "0"
                }
            ],
            "triggerid": "13272",
            "expression": "{12598}<20",
            "description": "Free inodes is less than 20% on volume {#FSNAME}",
            "url": "",
            "status": "0",
            "priority": "2",
            "comments": "",
            "templateid": "0",
            "type": "0",
            "flags": "2"
        },
        {
            "functions": [
                {
                    "functionid": "13500",
                    "itemid": "22686",
                    "function": "last",
                    "parameter": "0"
                }
            ],
            "triggerid": "13266",
            "expression": "{13500}<201",
            "description": "Free disk space is less than 20% on volume {#FSNAME}",
            "url": "",
            "status": "0",
            "priority": "2",
            "comments": "",
            "templateid": "0",
            "type": "0",
            "flags": "2"
        }
    ],
    "id": 1
}

See also

Source

CTriggerPrototype::get() in frontends/php/api/classes/CTriggerPrototype.php.