Ad Widget

Collapse

Get alarm/event description with use of json API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • runemy
    Junior Member
    • Apr 2014
    • 5

    #1

    Get alarm/event description with use of json API

    Hi

    Based on triggerid and hostid I need to get the latest (current) event description with use of the json API. I'm running zabbix version 2.2.

    Posting this json:

    {
    "jsonrpc": "2.0",
    "method": "event.get",
    "params": {
    "objectids": 15415,
    "hostids": 10214,
    "output": "extend"
    },
    "auth": "809wqeiurasdfkjadsowiequrdfj07",
    "id": 1
    }

    I get this returned:

    <Response xmlns="https://zabbix.svada.com/zabbix/api_jsonrpc.php">
    <id>1</id>
    <jsonrpc>2.0</jsonrpc>
    <result>
    <e>
    <acknowledged>0</acknowledged>
    <clock>1398177420</clock>
    <eventid>89539</eventid>
    <hosts>
    <e>
    <hostid>10214</hostid>
    </e>
    </hosts>
    <ns>365964160</ns>
    <object>0</object>
    <objectid>15415</objectid>
    <source>0</source>
    <value>1</value>
    </e>
    </result>
    </Response>


    But this do not contain the event description (alarm text). Can anyone give me some advice on what I need to do to get the event description?

    Br. Rune
  • runemy
    Junior Member
    • Apr 2014
    • 5

    #2
    Solved

    Hi

    Thanks to this thread I have solved my case:


    I understand that trigger.get is the right call to use, not event.get. The magic was to add to trigger.get:
    expandData: 1
    expandDescription: 1

    This is my final json call:

    {
    "jsonrpc": "2.0",
    "method": "trigger.get",
    "params": {
    "triggerids": "15415",
    "hostids": 10214,
    "output": ["description"],
    "expandData": "1",
    "expandDescription": "1"
    },
    "auth": "swoeiru09mxzniuewfjsl575e7",
    "id": 1
    }

    Br. Rune

    Comment

    Working...