icingaweb2/modules/monitoring/application/views/scripts/show/components/statusIcons.phtml

50 lines
1.5 KiB
PHTML

<?php
use Icinga\Module\Monitoring\Object\Service;
$o = $this->object;
$isService = $o instanceof Service;
$obj = new \stdClass();
$obj->handled =
($isService) ? $o->service_handled : $o->host_handled;
$obj->state =
($isService) ? $o->service_state : $o->host_state;
$obj->acknowledged =
($isService) ? $o->service_acknowledged : $o->host_acknowledged;
$obj->in_downtime =
($isService) ? $o->in_downtime : $o->host_in_downtime;
$obj->notifications_enabled =
($isService) ? $o->notifications_enabled : $o->service_notifications_enabled;
$obj->active_checks_enabled =
($isService) ? $o->active_checks_enabled : $o->host_active_checks_enabled;
$obj->passive_checks_enabled =
($isService) ? $o->passive_checks_enabled : $o->host_passive_checks_enabled;
$i = array();
if (! $obj->handled && $obj->state > 0) {
$i[] = $this->icon('attention-alt', $this->translate('Unhandled'));
}
if ($obj->acknowledged && ! $obj->in_downtime) {
$i[] = $this->icon('ok', $this->translate('Acknowledged'));
}
if (!$obj->notifications_enabled) {
$i[] = $this->icon('bell-of-empty', $this->translate('Notifications Disabled'));
}
if ($obj->in_downtime) {
$i[] = $this->icon('plug', $this->translate('In Downtime'));
}
if (! $obj->active_checks_enabled) {
if ($obj->passive_checks_enabled) {
$i[] = $this->icon('eye-off', $this->translate('Active Checks Disabled'));
} else {
$i[] = $this->icon('eye-off', $this->translate('Active And Passive Checks Disabled'));
}
}
?><?= implode("\n", $i) ?>