Ad Widget

Collapse

How correlate problem.get or event.get object with host?

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • albertokg
    Junior Member
    • Feb 2023
    • 6

    #1

    How correlate problem.get or event.get object with host?

    Hello,
    I'm using the Zabbix API to retrieve all the problems using both "problem.get" and "event.get" methods.
    But in the output I don't see any information about the host that generated the problem.
    How do I correlate the event object with the host? Or the problem event object with the host?

    This is my methods invocation:


    Code:
    {
    "jsonrpc": "2.0",
    "method": "problem.get",
    "params": {
    "output": "extend",
    "selectAcknowledges": "extend",
    "selectTags": "extend",
    "selectSuppressionData": "extend",
    "recent": "true",
    "sortfield": ["eventid"],
    "sortorder": "DESC"
    },
    "auth": "zabbix_account_token",
    "id": 1
    }
    Code:
    {
    "jsonrpc": "2.0",
    "method": "event.get",
    "params": {
    "output": "extend",
    "select_acknowledges": "extend",
    "selectTags": "extend",
    "selectSuppressionData": "extend",
    "eventids": "41606673",
    "sortfield": ["clock", "eventid"],
    "sortorder": "DESC"
    },
    "auth": "zabbix_account_token",
    "id": 1
    }
    ​And this is the output of the problem event object:

    Code:
    {
    "jsonrpc": "2.0",
    "result": [
    {
    "eventid": "41606673",
    "source": "0",
    "object": "0",
    "objectid": "26399",
    "clock": "1741021620",
    "ns": "407117816",
    "r_eventid": "0",
    "r_clock": "0",
    "r_ns": "0",
    "correlationid": "0",
    "userid": "0",
    "name": "Linux: High swap space usage (less than 20% free)",
    "acknowledged": "0",
    "severity": "2",
    "opdata": "Free: 0.02501 %, total: 1.6 GB",
    "acknowledges": [],
    "suppression_data": [],
    "suppressed": "0",
    "urls": [],
    "tags": [
    {
    "tag": "scope",
    "value": "capacity"
    },
    {
    "tag": "component",
    "value": "memory"
    },
    {
    "tag": "component",
    "value": "storage"
    },
    {
    "tag": "class",
    "value": "os"
    },
    {
    "tag": "target",
    "value": "linux"
    }
    ]
    },


    And this of the event object:

    Code:
    ​{
    "jsonrpc": "2.0",
    "result": [
    {
    "eventid": "41606673",
    "source": "0",
    "object": "0",
    "objectid": "26399",
    "clock": "1741021620",
    "value": "1",
    "acknowledged": "0",
    "ns": "407117816",
    "name": "Linux: High swap space usage (less than 20% free)",
    "severity": "2",
    "r_eventid": "0",
    "c_eventid": "0",
    "correlationid": "0",
    "userid": "0",
    "opdata": "Free: 0.06931 %, total: 1.6 GB",
    "acknowledges": [],
    "suppression_data": [],
    "suppressed": "0",
    "urls": [],
    "tags": [
    {
    "tag": "scope",
    "value": "capacity"
    },
    {
    "tag": "component",
    "value": "memory"
    },
    {
    "tag": "component",
    "value": "storage"
    },
    {
    "tag": "class",
    "value": "os"
    },
    {
    "tag": "target",
    "value": "linux"
    }
    ]
    }
    ],
    "id": 1
    }​


    Thanks


  • Answer selected by albertokg at 04-03-2025, 20:10.
    cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    Code:
    "object": "0",
    "objectid": "26399",

    object 0 is "trigger" with "object (trigger) id" 26399...
    https://www.zabbix.com/documentation...ce/trigger/get (selectHosts).

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #2
      Code:
      "object": "0",
      "objectid": "26399",

      object 0 is "trigger" with "object (trigger) id" 26399...
      https://www.zabbix.com/documentation...ce/trigger/get (selectHosts).

      Comment

      • albertokg
        Junior Member
        • Feb 2023
        • 6

        #3
        Hello cyber,
        thank you very much for your help.

        Regards,
        Alberto

        Comment

        Working...