2021-06-08 07:40:17 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/* Icinga DB Web | (c) 2021 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Icingadb\Controllers;
|
|
|
|
|
|
|
|
|
|
use Icinga\Module\Icingadb\Model\History;
|
|
|
|
|
use Icinga\Module\Icingadb\Web\Controller;
|
|
|
|
|
use Icinga\Module\Icingadb\Widget\Detail\EventDetail;
|
2025-03-24 08:34:08 -04:00
|
|
|
use Icinga\Module\Icingadb\Widget\Detail\ObjectHeader;
|
2021-06-08 07:40:17 -04:00
|
|
|
use ipl\Stdlib\Filter;
|
|
|
|
|
|
|
|
|
|
class EventController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/** @var History */
|
|
|
|
|
protected $event;
|
|
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
|
{
|
2022-03-16 11:06:00 -04:00
|
|
|
$this->addTitleTab(t('Event'));
|
2021-06-08 07:40:17 -04:00
|
|
|
|
2021-08-31 06:34:18 -04:00
|
|
|
$id = $this->params->getRequired('id');
|
2021-06-08 07:40:17 -04:00
|
|
|
|
|
|
|
|
$query = History::on($this->getDb())
|
|
|
|
|
->with([
|
|
|
|
|
'host',
|
|
|
|
|
'host.state',
|
|
|
|
|
'service',
|
|
|
|
|
'service.state',
|
|
|
|
|
'comment',
|
|
|
|
|
'downtime',
|
2021-08-12 10:30:09 -04:00
|
|
|
'downtime.parent',
|
|
|
|
|
'downtime.parent.host',
|
|
|
|
|
'downtime.parent.host.state',
|
|
|
|
|
'downtime.parent.service',
|
|
|
|
|
'downtime.parent.service.state',
|
|
|
|
|
'downtime.triggered_by',
|
|
|
|
|
'downtime.triggered_by.host',
|
|
|
|
|
'downtime.triggered_by.host.state',
|
|
|
|
|
'downtime.triggered_by.service',
|
|
|
|
|
'downtime.triggered_by.service.state',
|
2021-06-08 07:40:17 -04:00
|
|
|
'flapping',
|
|
|
|
|
'notification',
|
|
|
|
|
'acknowledgement',
|
|
|
|
|
'state'
|
|
|
|
|
])
|
|
|
|
|
->filter(Filter::equal('id', hex2bin($id)));
|
|
|
|
|
|
|
|
|
|
$this->applyRestrictions($query);
|
|
|
|
|
|
|
|
|
|
$event = $query->first();
|
|
|
|
|
if ($event === null) {
|
|
|
|
|
$this->httpNotFound(t('Event not found'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->event = $event;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
|
{
|
2025-03-24 08:34:08 -04:00
|
|
|
$this->addControl(new ObjectHeader($this->event));
|
|
|
|
|
$this->addContent(new EventDetail($this->event));
|
2021-06-08 07:40:17 -04:00
|
|
|
}
|
|
|
|
|
}
|