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('unhandled.png', 'Unhandled');
}
if ($obj->acknowledged && ! $obj->in_downtime) {
$i[] = $this->icon('acknowledgement.png', 'Acknowledged');
}
if (!$obj->notifications_enabled) {
$i[] = $this->icon('notification_disabled.png', 'Notifications Disabled');
}
if ($obj->in_downtime) {
$i[] = $this->icon('in_downtime.png', 'In Downtime');
}
if (! $obj->active_checks_enabled) {
if ($obj->passive_checks_enabled) {
$i[] = $this->icon('active_checks_disabled.png', 'Active Checks Disabled');
} else {
$i[] = $this->icon('active_passive_checks_disabled.png', 'Active And Passive Checks Disabled');
}
}
?><?= implode("\n", $i) ?>