// echo "<div class=\"groupbox\">"; // Again, we dont want to use the groupfunction yet // echo "<div class=\"title\">" . $groupname . "</div>"; // print all host IDs foreach ($hosts as $host) { // Check if host is not disabled, we don't want them! $flaghost = $host->flags; if ($flaghost == "0" && $count == "0") { echo "<div class=\"groupbox js-masonry\" data-masonry-options='{ \"itemSelector\": \".hostbox\" }'\">"; // echo "<div class=\"title\">" . $groupname . "</div>"; $count++; } if ($flaghost == "0" && $count != "0") { $hostid = $host->hostid; $hostname = $host->name; $maintenance = $host->maintenance_status; $trigger = $api->triggerGet(array('output' => 'extend', 'hostids' => $hostid, 'sortfield' => 'priority', 'sortorder' => 'DESC', 'only_true' => '1', 'active' => '1', 'withUnacknowledgedEvents' => '1')); if ($trigger) { // Highest Priority error $hostboxprio = $trigger[0]->priority; //First filter the hosts that are in maintenance and assign the maintenance class if is true if ($maintenance != "0") { echo "<div class=\"hostbox maintenance\">"; } else { echo "<div class=\"hostbox nok" . $hostboxprio . "\">"; } echo "<div class=\"title\">" . $hostname . "</div><div class=\"hostid\">" . $hostid . "</div>"; $count = "0"; foreach ($trigger as $event) { if ($count++ <= 2) { $priority = $event->priority; $description = $event->description;