Ad Widget

Collapse

[API] How to get trigger ID by host name?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DenisBY
    Member
    • Jul 2006
    • 44

    #1

    [API] How to get trigger ID by host name?

    Full task:
    Via API disable/enable trigger which belongs to some host. Only part of host name is known, i.e. zabbix has host name like 'prod-role-prio-i-aabbccdd", but external script know only instance id, 'i-aabbccdd'.

    Easy way: find host ID using host name via 'search' in host.get and then use that ID in trigger.get.
    But maybe there is a way to do this in one query?

    I've tried something like this:
    Code:
    {
        "output": "triggerids",
        "selectHosts": {
            "search": {
                "name": "i-aabbccdd"
            }
        },
        "search": {
            "description": "Supervisord STOPPED State of worker application on host"
        }
    }
    But it shows all hosts those have that trigger. How to show trigger which belongs only to host "*i-aabbccdd"?
    I can't use 'host' parameter in trigger.get because it requires full host name, but only part of host name is know (by external script).
    Last edited by DenisBY; 27-07-2016, 18:25.
Working...