mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-22 13:24:24 +02:00
parent
61bfcd495b
commit
18bd1c3221
@ -86,6 +86,7 @@ class Monitoring_ShowController extends ActionController
|
|||||||
public function serviceAction()
|
public function serviceAction()
|
||||||
{
|
{
|
||||||
$this->view->object->prefetch();
|
$this->view->object->prefetch();
|
||||||
|
$this->view->object->eventHistory = $this->view->object->eventHistory->limit(10)->fetchAll();
|
||||||
$this->view->preserve = array();
|
$this->view->preserve = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ class Zend_View_Helper_MonitoringProperties extends Zend_View_Helper_Abstract
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNotificationType(AbstractObject $notification)
|
public function getNotificationType($notification)
|
||||||
{
|
{
|
||||||
$reason = intval($notification->notification_reason);
|
$reason = intval($notification->notification_reason);
|
||||||
if (!isset(self::$notificationReasons[$reason])) {
|
if (!isset(self::$notificationReasons[$reason])) {
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
<?php if (!empty($object->eventHistory)): ?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<span>History</span>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<table class="table table-condensed">
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($object->eventHistory as $event): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= date('d.m. H:i', $event->timestamp); ?></td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<?php if (!$object instanceof Icinga\Module\Monitoring\Object\Service): ?>
|
||||||
|
<a href="<?= $this->href('monitoring/show/service', array(
|
||||||
|
'host' => $object->host_name,
|
||||||
|
'service' => $event->service_description
|
||||||
|
)); ?>">
|
||||||
|
<?= $event->service_description ?>
|
||||||
|
</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?= $this->href('monitoring/show/host', array(
|
||||||
|
'host' => $object->host_name
|
||||||
|
)); ?>">
|
||||||
|
<?= $event->host_name ?>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
switch ($event->type) {
|
||||||
|
case 'notify':
|
||||||
|
$icon = '{{NOTIFICATION_ICON}}';
|
||||||
|
$title = 'Notification';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'comment':
|
||||||
|
$icon = '{{COMMENT_ICON}}';
|
||||||
|
$title = 'Comment';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'ack':
|
||||||
|
$icon = '{{ACKNOWLEDGEMENT_ICON}}';
|
||||||
|
$title = 'Acknowledgement';
|
||||||
|
$msg = '';
|
||||||
|
break;
|
||||||
|
case 'dt_comment':
|
||||||
|
$icon = '{{IN_DOWNTIME_ICON}}';
|
||||||
|
$title = 'In Downtime';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'flapping':
|
||||||
|
$icon = '{{FLAPPING_ICON}}';
|
||||||
|
$title = 'Flapping';
|
||||||
|
$msg = '';
|
||||||
|
break;
|
||||||
|
case 'hard_state':
|
||||||
|
$icon = '{{HARDSTATE_ICON}}';
|
||||||
|
$title = 'Hard State';
|
||||||
|
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
|
||||||
|
break;
|
||||||
|
case 'soft_state':
|
||||||
|
$icon = '{{SOFTSTATE_ICON}}';
|
||||||
|
$title = 'Soft State';
|
||||||
|
$msg = '[' . $event->attempt . '/' . $event->max_attempts . ']';
|
||||||
|
break;
|
||||||
|
case 'dt_start':
|
||||||
|
$icon = '{{DOWNTIME_START_ICON}}';
|
||||||
|
$title = 'Downtime Start';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
case 'dt_end':
|
||||||
|
$icon = '{{DOWNTIME_END_ICON}}';
|
||||||
|
$title = 'Downtime End';
|
||||||
|
$msg = $event->output;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<a href="#" title="<?= $title ?>"><i><?= $icon ?></i></a>
|
||||||
|
<?php if (!empty($msg)) { echo $msg; } ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<? endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
@ -31,6 +31,8 @@ class EventHistoryQuery extends AbstractQuery
|
|||||||
'output' => 'eh.output', // we do not want long_output
|
'output' => 'eh.output', // we do not want long_output
|
||||||
//'problems' => 'CASE WHEN eh.state = 0 OR eh.state IS NULL THEN 0 ELSE 1 END',
|
//'problems' => 'CASE WHEN eh.state = 0 OR eh.state IS NULL THEN 0 ELSE 1 END',
|
||||||
'type' => 'eh.type',
|
'type' => 'eh.type',
|
||||||
|
'service_host_name' => 'eho.name1 COLLATE latin1_general_ci',
|
||||||
|
'service_description' => 'eho.name2 COLLATE latin1_general_ci'
|
||||||
),
|
),
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||||
@ -74,7 +76,7 @@ class EventHistoryQuery extends AbstractQuery
|
|||||||
}
|
}
|
||||||
if ($end) {
|
if ($end) {
|
||||||
foreach ($this->subQueries as $query) {
|
foreach ($this->subQueries as $query) {
|
||||||
$query->where('raw_timestamp', '<' . $start);
|
$query->where('raw_timestamp', '<' . $end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL);
|
$sub = $this->db->select()->union($this->subQueries, Zend_Db_Select::SQL_UNION_ALL);
|
||||||
|
@ -143,7 +143,7 @@ abstract class AbstractObject
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchEventHisoty()
|
protected function fetchEventHistory()
|
||||||
{
|
{
|
||||||
$this->foreign['eventHistory'] = $this->applyObjectFilter(
|
$this->foreign['eventHistory'] = $this->applyObjectFilter(
|
||||||
$this->backend->select()->from('eventHistory', array(
|
$this->backend->select()->from('eventHistory', array(
|
||||||
@ -158,6 +158,7 @@ abstract class AbstractObject
|
|||||||
'type'
|
'type'
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
// echo $this->foreign['eventHistory']->dump();die;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class Service extends AbstractObject
|
|||||||
->fetchContactgroups()
|
->fetchContactgroups()
|
||||||
->fetchCustomvars()
|
->fetchCustomvars()
|
||||||
->fetchComments()
|
->fetchComments()
|
||||||
->fetchEventHisoty();
|
->fetchEventHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchObject()
|
protected function fetchObject()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user