Ad Widget

Collapse

API request to receive all hosts in HostGroups regardless of maintenance status

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agpritchett
    Junior Member
    • Nov 2014
    • 3

    #1

    API request to receive all hosts in HostGroups regardless of maintenance status

    Hi All,
    I'm trying to use the API to get a list of hosts managed by my zabbix (I'm making a chart, but that doesn't matter). My API call is only returning hosts which belong to hostgroups that are not in maintenance, but I want them all. I'm using PHPZabbixAPI if that matters:


    Here is my API call:

    PHP Code:
    $hosts $api->hostGet(array(
            
    'output' => array(
                
    'name',
                
    'groupid',
                
    'hostid',
                
    'maintenanceid'
            
    ),
            
    'sortfield' => 'name'
        
    )); 
    It returns all of my hosts that are not ONLY in a group which is in maintenance.

    For an example:
    HOSTGROUP1 has
    • host1
    • host2
    • host3
    • host4

    HOSTGROUP2 has
    • host4
    • host5
    • host6
    • host7

    If HOSTGROUP2 is in maintenance, my API call only returns
    host1, host2, host3, and host4. Host 5, host6, and host7 don't get returned.

    Any suggestions to retrieve a list of ALL hosts?
    Thanks!
Working...