Skip to content

Commit

Permalink
Merge branch 'feature/alert-summary-4074'
Browse files Browse the repository at this point in the history
resolves #4074
resolves #4473
  • Loading branch information
mxhash committed Oct 8, 2014
2 parents f77a0e9 + 6622042 commit db804f9
Show file tree
Hide file tree
Showing 9 changed files with 772 additions and 2 deletions.
620 changes: 620 additions & 0 deletions modules/monitoring/application/controllers/AlertsummaryController.php

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions modules/monitoring/application/controllers/ListController.php
Expand Up @@ -32,6 +32,10 @@ public function init()
{
$this->createTabs();
$this->view->compact = $this->_request->getParam('view') === 'compact';
if ($this->_request->getParam('view') === 'inline') {
$this->view->compact = true;
$this->view->inline = true;
}
$this->url = Url::fromRequest();
}

Expand Down
Expand Up @@ -22,6 +22,15 @@ public function monitoringState($object, $type = 'service')
}
}

public function monitoringStateById($id, $type = 'service')
{
if ($type === 'service') {
return $this->servicestates[$id];
} elseif ($type === 'host') {
return $this->hoststates[$id];
}
}

/**
* @deprecated Monitoring colors are clustered.
*/
Expand Down
Empty file.
@@ -0,0 +1,82 @@
<?php
$helper = $this->getHelper('MonitoringState');
?>
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em;" class="dontprint">
<?= $intervalBox; ?>
</div>
<?= $this->widget('limiter') ?>
<?= $this->paginationControl($notifications, null, null, array('preserve' => $this->preserve)) ?>
</div>

<div class="content alertsummary">
<h1><?= $this->translate('Alert summary'); ?></h1>

<div class="alertsummary-flex-container">
<div class="alertsummary-flex">
<h2><?= $this->translate('Notifications and problems'); ?></h2>
<div>
<?= $defectChart->render(); ?>
</div>
</div>

<div class="alertsummary-flex">
<h2><?= $this->translate('Time to reaction (Ack, Recover)'); ?></h2>
<div>
<?= $healingChart->render(); ?>
</div>
</div>
</div>

<h2><?= $this->translate('Trend'); ?></h2>

<div class="alertsummary-flex-container">
<div class="alertsummary-flex">
<?= $this->translate('Average') ?>
<strong><?= $this->perf->avg; ?></strong>
<?= $this->translate('notifications per hour'); ?>,
<strong><?= $this->perf->last; ?></strong>
<?= $this->translate('in the last hour'); ?>.

<?= $this->translate('Trend for the last 24h'); ?>
(<?= $this->trend->percent; ?>%
<strong><?= $this->translate($this->trend->trend); ?></strong>)

<span>
<?php if ($this->trend->trend === 'up'): ?>
<?= $this->icon('up.png'); ?>
<?php elseif ($this->trend->trend === 'unchanged'): ?>
<?= $this->icon('next.png'); ?>
<?php else: ?>
<?= $this->icon('down.png'); ?>
<?php endif; ?>
</span>
</div>
</div>

<?php if ($this->recentAlerts): ?>
<h2><?= $this->translate('Top 5 recent alerts'); ?></h2>

<div class="alertsummary-flex-container">
<div class="alertsummary-flex">
<?= $this->partial('list/notifications.phtml', array(
'notifications' => $this->recentAlerts,
'compact' => true,
'inline' => true
)); ?>
</div>
</div>
<?php endif; ?>

<h2><?= $this->translate('History'); ?></h2>
<div class="alertsummary-flex-container">
<div class="alertsummary-flex">
<?= $this->partial('list/notifications.phtml', array(
'notifications' => $this->notifications,
'compact' => true,
'inline' => true
)); ?>
</div>
</div>
</div>
@@ -1,4 +1,3 @@

<?php if (!$this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
Expand All @@ -10,7 +9,10 @@
</div>
<?php endif ?>

<?php if (! $this->inline): ?>
<div class="content">
<?php endif; ?>

<?php

if (empty($this->notifications)) {
Expand Down Expand Up @@ -75,4 +77,6 @@ foreach ($notifications as $notification):
</tbody>
</table>

<?php if (!$this->inline): ?>
</div>
<?php endif; ?>
12 changes: 12 additions & 0 deletions modules/monitoring/configuration.php
Expand Up @@ -122,6 +122,18 @@
));
$section->add($this->translate('Timeline'))->setUrl('monitoring/timeline');

/*
* Reporting Section
*/
$section = $this->menuSection($this->translate('Reporting'), array(
'icon' => 'img/icons/hostgroup.png',
'priority' => 100
));

$section->add($this->translate('Alert Summary'), array(
'url' => 'monitoring/alertsummary/index'
));

/*
* System Section
*/
Expand Down
Expand Up @@ -18,7 +18,8 @@ class NotificationQuery extends IdoQuery
'notification' => array(
'notification_output' => 'n.output',
'notification_start_time' => 'UNIX_TIMESTAMP(n.start_time)',
'notification_state' => 'n.state'
'notification_state' => 'n.state',
'notification_object_id' => 'n.object_id'
),
'objects' => array(
'host' => 'o.name1',
Expand All @@ -30,6 +31,11 @@ class NotificationQuery extends IdoQuery
),
'command' => array(
'notification_command' => 'cmd_o.name1'
),
'acknowledgement' => array(
'acknowledgement_entry_time' => 'UNIX_TIMESTAMP(a.entry_time)',
'acknowledgement_author_name' => 'a.author_name',
'acknowledgement_comment_data' => 'a.comment_data'
)
);

Expand Down Expand Up @@ -95,4 +101,13 @@ protected function joinCommand()
array()
);
}

protected function joinAcknowledgement()
{
$this->select->joinLeft(
array('a' => $this->prefix . 'acknowledgements'),
'n.object_id = a.object_id',
array()
);
}
}
24 changes: 24 additions & 0 deletions modules/monitoring/public/css/module.less
Expand Up @@ -134,3 +134,27 @@ span.state.pending {
form.instance-features span.description, form.object-features span.description {
display: inline;
}

.alertsummary-flex-container {
display: -ms-Flexbox;
-ms-box-orient: horizontal;

display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;

-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
}

.alertsummary-flex {
flex: 1 1 auto;
overflow: auto;
border: 1px #333 solid;
padding: 5px;
margin: 0 10px 0 0;
border-spacing: 10px 10px;
}

0 comments on commit db804f9

Please sign in to comment.