Hosts of hostgroup down and not in downtime

This forum was archived to /woltlab and is now in read-only mode.
  • Hi,

    I started to wrote an Icingaweb2 module and have a problem...

    I need to get the hosts_down of a hostgroup, that is easy:

    1.     $columns = array(
    2. 'hostgroup_alias',
    3. 'hostgroup_name',
    4. 'hosts_down_unhandled',
    5. 'hosts_total'
    6. );
    7. $query = $this->backend->select()->from('hostgroupsummary', $columns);
    8. $query->applyFilter(Filter::matchAll(Filter::where('hostgroup_name', 'StreetSer*')));// only locations
    9. $hostGroups = $query->getQuery()->fetchAll();

    My problem is: with hosts_down_unhandled I also get hosts in downtime, wich I don't want to have. With hosts_down_handled I wouldn't get hosts in downtime, but I also wouldn't get acknowledged hosts (but I want them also). So I do

    As you can see the query is executed several times - and that's a big problem with much hosts and hostgroups. The script needs about 30 seconds now (script does something more I wrote) and it's not ready :huh:

    Does anybody knows a better solution for this?

    Thanks :)