This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

action.get

Description

integer/array action.get(object parameters)

The method allows to retrieve actions according to the given parameters.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
actionids string/array Return only actions with the given IDs.
groupids string/array Return only actions that use the given host groups in action conditions.
hostids string/array Return only actions that use the given hosts in action conditions.
triggerids string/array Return only actions that use the given triggers in action conditions.
mediatypeids string/array Return only actions that use the given media types to send messages.
usrgrpids string/array Return only actions that are configured to send messages to the given user groups.
userids string/array Return only actions that are configured to send messages to the given users.
scriptids string/array Return only actions that are configured to run the given scripts.
selectConditions query Return an object containing the action conditions in the conditions property.

Does not support shorten or arrays of properties.
selectOperations query Return an object containing the action operations in the operations property.

Does not support shorten or arrays of properties.
sortfield string/array Sort the result by the given properties.

Possible values are: actionid, name and status.
countOutput flag These parameters being common for all get methods are described in detail on the Generic Zabbix API information page.
editable boolean
excludeSearch flag
filter object
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 discovery actions

Retrieve all configured discovery actions together with action conditions and operations.

Request:

{
           "jsonrpc": "2.0",
           "method": "action.get",
           "params": {
               "output": "extend",
               "selectOperations": "extend",
               "selectConditions": "extend",
               "filter": {
                   "eventsource": 1
               }
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "actionid": "2",
                   "name": "Auto discovery. Linux servers.",
                   "eventsource": "1",
                   "evaltype": "0",
                   "status": "1",
                   "esc_period": "0",
                   "def_shortdata": "",
                   "def_longdata": "",
                   "recovery_msg": "0",
                   "r_shortdata": "",
                   "r_longdata": "",
                   "conditions": {
                       "2": {
                           "conditionid": "2",
                           "actionid": "2",
                           "conditiontype": "10",
                           "operator": "0",
                           "value": "0"
                       },
                       "3": {
                           "conditionid": "3",
                           "actionid": "2",
                           "conditiontype": "8",
                           "operator": "0",
                           "value": "9"
                       },
                       "4": {
                           "conditionid": "4",
                           "actionid": "2",
                           "conditiontype": "12",
                           "operator": "2",
                           "value": "Linux"
                       }
                   },
                   "operations": {
                       "1": {
                           "operationid": "1",
                           "actionid": "2",
                           "operationtype": "6",
                           "esc_period": "0",
                           "esc_step_from": "1",
                           "esc_step_to": "1",
                           "evaltype": "0",
                           "opconditions": [],
                           "optemplate": [
                               {
                                   "operationid": "1",
                                   "templateid": "10001"
                               }
                           ]
                       },
                       "2": {
                           "operationid": "2",
                           "actionid": "2",
                           "operationtype": "4",
                           "esc_period": "0",
                           "esc_step_from": "1",
                           "esc_step_to": "1",
                           "evaltype": "0",
                           "opconditions": [],
                           "opgroup": [
                               {
                                   "operationid": "2",
                                   "groupid": "2"
                               }
                           ]
                       }
                   }
               }
           ],
           "id": 1
       }

See also

Source

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