Ad Widget

Collapse

[API - Trigger.get] Where is host name?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shahin
    Junior Member
    • Jun 2020
    • 4

    #1

    [API - Trigger.get] Where is host name?

    Hi,
    I'd want to do a request HTTP to Zabbix API in order to get some informations about triggers (in problem state). So I use trigger.get.
    I saw that we can get trigger id, the description and other infos.
    But I didn't see the host to which the alert refers. I'd want to get the host name or the ip address of the host.

    Anyone can help me ??
    Thank's!
  • stupen8
    Junior Member
    • Mar 2021
    • 1

    #2
    Hi,

    Can someone help to get the hostname in the trigger.get API ? Have done a fair amount of research but unable to get the hostname of the trigger which that belongs to.

    Comment

    • dimir
      Zabbix developer
      • Apr 2011
      • 1080

      #3
      Add selectHosts with array of fields to select to the parameters of request:
      Code:
      "params": {"selectHosts": ['host', 'hostid']}
      In this case for each trigger a list of hosts with name and hostid will be returned in the "hosts" field of response.

      See more about selectHosts here: https://www.zabbix.com/documentation...ce/trigger/get

      Comment

      Working...