Ad Widget

Collapse

Zabbix action API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CSanchezAustin
    Junior Member
    • Feb 2015
    • 1

    #1

    Zabbix action API

    I am developing an application to integrate Zabbix APIs. I installed Zabbix 2.4.3 and created an action using the web UI. When I try to query the actions using the API I am not receiving the "conditions" array. I'm following this https://www.zabbix.com/documentation...nce/action/get. FYI: I am using the admin login as the API user. Any ideas on how to get back the conditions?

    e.g.

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

    Here's the response I get.

    {
    "jsonrpc": "2.0",
    "result": [
    {
    "actionid": "2",
    "operations": [
    {
    "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"
    }
    ]
    },
    {
    "operationid": "2",
    "actionid": "2",
    "operationtype": "4",
    "esc_period": "0",
    "esc_step_from": "1",
    "esc_step_to": "1",
    "evaltype": "0",
    "opconditions": [],
    "opgroup": [
    {
    "operationid": "2",
    "groupid": "8"
    }
    ]
    }
    ]
    },
    {
    "actionid": "8",
    "operations": [
    {
    "operationid": "10",
    "actionid": "8",
    "operationtype": "2",
    "esc_period": "0",
    "esc_step_from": "1",
    "esc_step_to": "1",
    "evaltype": "0",
    "opconditions": []
    }
    ]
    }
    ],
    "id": 1
    }


    Looking at actionconf.php I see the following which doesn't seem to include a similar selection for "selectConditions", though I'm not sure if this is right place to look since I'm not familiar with the code.

    $action = null;
    if ($data['actionid']) {
    $data['action'] = API::Action()->get(array(
    'actionids' => $data['actionid'],
    'selectOperations' => API_OUTPUT_EXTEND,
    'selectFilter' => array('formula', 'conditions', 'evaltype'),
    'output' => API_OUTPUT_EXTEND,
    'editable' => true
    ));
Working...