Merge branch 'master' of git.icinga.org:icingaweb2

This commit is contained in:
Alexander Klimov 2014-03-11 15:44:08 +01:00
commit f1dcc4c15e
9 changed files with 204 additions and 316 deletions

View File

@ -22,17 +22,11 @@ class Monitoring_TacticalController extends MonitoringController
$this->_request, $this->_request,
array( array(
'hosts_up', 'hosts_up',
'hosts_up_not_checked',
'hosts_pending', 'hosts_pending',
'hosts_pending_not_checked', 'hosts_down',
'hosts_down_handled',
'hosts_down_unhandled', 'hosts_down_unhandled',
'hosts_down_passive', 'hosts_unreachable',
'hosts_down_not_checked',
'hosts_unreachable_handled',
'hosts_unreachable_unhandled', 'hosts_unreachable_unhandled',
'hosts_unreachable_passive',
'hosts_unreachable_not_checked',
'services_ok_on_ok_hosts', 'services_ok_on_ok_hosts',
'services_ok_not_checked_on_ok_hosts', 'services_ok_not_checked_on_ok_hosts',

View File

@ -9,7 +9,7 @@
<div class="box contactgroup"> <div class="box contactgroup">
<h2><?= $groupInfo['alias']; ?></h2> <h2><?= $groupInfo['alias']; ?></h2>
<?php if ($groupInfo['alias'] !== $groupName): ?> <?php if ($groupInfo['alias'] !== $groupName): ?>
<h3><?= $groupName; ?></h3> <h2><?= $groupName; ?></h2>
<?php endif ?> <?php endif ?>
<div class="box contents"> <div class="box contents">
<?php foreach ($groupInfo['contacts'] as $c): ?> <?php foreach ($groupInfo['contacts'] as $c): ?>

View File

@ -7,9 +7,11 @@
<div class="boxview" data-base-target="_next"> <div class="boxview" data-base-target="_next">
<?php foreach($hostgroups as $h): ?> <?php foreach($hostgroups as $h): ?>
<div class="box hostgroup"> <div class="box hostgroup">
<a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $h->hostgroup)); ?>"> <h2>
<h2><?= $h->hostgroup; ?></h2> <a href="<?= $this->href('monitoring/list/services', array('hostgroup' => $h->hostgroup)); ?>">
</a> <?= $h->hostgroup; ?>
</a>
</h2>
<div class="box contents"> <div class="box contents">
<table> <table>
<thead> <thead>

View File

@ -7,12 +7,14 @@
<div class="boxview" data-base-target="_next"> <div class="boxview" data-base-target="_next">
<?php foreach($servicegroups as $servicegroup): ?> <?php foreach($servicegroups as $servicegroup): ?>
<div class="box servicegroup"> <div class="box servicegroup">
<a href="<?= $this->href( <h2>
'monitoring/list/services', <a href="<?= $this->href(
array('servicegroup' => $servicegroup->servicegroup) 'monitoring/list/services',
); ?>"> array('servicegroup' => $servicegroup->servicegroup)
<h2><?= $servicegroup->servicegroup; ?></h2> ); ?>">
</a> <?= $servicegroup->servicegroup; ?>
</a>
</h2>
<div class="box contents"> <div class="box contents">
<table> <table>
<thead> <thead>

View File

@ -1,113 +1,57 @@
<div class="box ok_hosts"> <?php
<h2><?= $this->translate('OK Hosts'); ?></h2> $service_problems = (
<div class="box contents"> $this->statusSummary->services_warning_handled_on_ok_hosts ||
<table> $this->statusSummary->services_warning_unhandled_on_ok_hosts ||
<thead> $this->statusSummary->services_critical_handled_on_ok_hosts ||
<tr> $this->statusSummary->services_critical_unhandled_on_ok_hosts ||
<th><?= $this->translate('Hosts'); ?></th> $this->statusSummary->services_unknown_handled_on_ok_hosts ||
<th><?= $this->translate('Services'); ?></th> $this->statusSummary->services_unknown_unhandled_on_ok_hosts
</tr> );
</thead> ?>
<tbody> <div class="box ok_hosts state_<?= $this->statusSummary->hosts_up ? 'up' : 'pending'; ?>">
<tr>
<td>
<?php if ($this->statusSummary->hosts_up): ?> <?php if ($this->statusSummary->hosts_up): ?>
<div class="box entry state_up"> <h2>
<a href="<?= $this->href( <a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 0)); ?>">
'monitoring/list/hosts', <?= sprintf($this->translate('%d Hosts UP'), $this->statusSummary->hosts_up); ?>
array('host_state' => 0) </a>
); ?>"> </h2>
<?= $this->statusSummary->hosts_up; ?> UP
</a>
<?php if ($this->statusSummary->hosts_up_not_checked): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 0,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 0
)
); ?>">
<?php
if ($this->statusSummary->hosts_up_not_checked > 1) {
printf(
$this->translate('%d are not checked at all'),
$this->statusSummary->hosts_up_not_checked
);
} else {
printf(
$this->translate('%d is not checked at all'),
$this->statusSummary->hosts_up_not_checked
);
}
?>
</a>
<?php endif ?>
</div>
<?php endif ?> <?php endif ?>
<?php if ($this->statusSummary->hosts_pending): ?> <?php if ($this->statusSummary->hosts_pending): ?>
<div class="box entry state_pending"> <h2>
<a href="<?= $this->href( <a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 99)); ?>">
'monitoring/list/hosts', <?= sprintf($this->translate('%d Hosts PENDING'), $this->statusSummary->hosts_pending); ?>
array('host_state' => 99) </a>
); ?>"> </h2>
<?= $this->statusSummary->hosts_pending; ?> PENDING
</a>
<?php if ($this->statusSummary->hosts_pending_not_checked): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 99,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 0
)
); ?>">
<?php
if ($this->statusSummary->hosts_pending_not_checked > 1) {
printf(
$this->translate('%d are not checked at all'),
$this->statusSummary->hosts_pending_not_checked
);
} else {
printf(
$this->translate('%d is not checked at all'),
$this->statusSummary->hosts_pending_not_checked
);
}
?>
</a>
<?php endif ?> <?php endif ?>
</div> <?php if ($service_problems || $this->statusSummary->hosts_down || $this->statusSummary->hosts_unreachable): ?>
<div class="box contents">
<strong><?= $this->translate('Services'); ?></strong>
<?= $this->partial(
'tactical/components/parts/servicestatesummarybyhoststate.phtml',
array(
'host_problem' => 0,
'services_ok' => $this->statusSummary->services_ok_on_ok_hosts,
'services_ok_not_checked' => $this->statusSummary->services_ok_not_checked_on_ok_hosts,
'services_pending' => $this->statusSummary->services_pending_on_ok_hosts,
'services_pending_not_checked' => $this->statusSummary->services_pending_not_checked_on_ok_hosts,
'services_warning_handled' => $this->statusSummary->services_warning_handled_on_ok_hosts,
'services_warning_unhandled' => $this->statusSummary->services_warning_unhandled_on_ok_hosts,
'services_warning_passive' => $this->statusSummary->services_warning_passive_on_ok_hosts,
'services_warning_not_checked' => $this->statusSummary->services_warning_not_checked_on_ok_hosts,
'services_critical_handled' => $this->statusSummary->services_critical_handled_on_ok_hosts,
'services_critical_unhandled' => $this->statusSummary->services_critical_unhandled_on_ok_hosts,
'services_critical_passive' => $this->statusSummary->services_critical_passive_on_ok_hosts,
'services_critical_not_checked' => $this->statusSummary->services_critical_not_checked_on_ok_hosts,
'services_unknown_handled' => $this->statusSummary->services_unknown_handled_on_ok_hosts,
'services_unknown_unhandled' => $this->statusSummary->services_unknown_unhandled_on_ok_hosts,
'services_unknown_passive' => $this->statusSummary->services_unknown_passive_on_ok_hosts,
'services_unknown_not_checked' => $this->statusSummary->services_unknown_not_checked_on_ok_hosts
)
); ?>
<?php else: ?>
<div class="box contents zero">
<h3>0</h3>
<span><?= $this->translate('Service Problems'); ?></span>
<?php endif ?> <?php endif ?>
</td>
<td>
<?php if ($this->statusSummary->hosts_up || $this->statusSummary->hosts_pending): ?>
<?= $this->partial(
'tactical/components/parts/servicestatesummarybyhoststate.phtml',
array(
'host_problem' => 0,
'services_ok' => $this->statusSummary->services_ok_on_ok_hosts,
'services_ok_not_checked' => $this->statusSummary->services_ok_not_checked_on_ok_hosts,
'services_pending' => $this->statusSummary->services_pending_on_ok_hosts,
'services_pending_not_checked' => $this->statusSummary->services_pending_not_checked_on_ok_hosts,
'services_warning_handled' => $this->statusSummary->services_warning_handled_on_ok_hosts,
'services_warning_unhandled' => $this->statusSummary->services_warning_unhandled_on_ok_hosts,
'services_warning_passive' => $this->statusSummary->services_warning_passive_on_ok_hosts,
'services_warning_not_checked' => $this->statusSummary->services_warning_not_checked_on_ok_hosts,
'services_critical_handled' => $this->statusSummary->services_critical_handled_on_ok_hosts,
'services_critical_unhandled' => $this->statusSummary->services_critical_unhandled_on_ok_hosts,
'services_critical_passive' => $this->statusSummary->services_critical_passive_on_ok_hosts,
'services_critical_not_checked' => $this->statusSummary->services_critical_not_checked_on_ok_hosts,
'services_unknown_handled' => $this->statusSummary->services_unknown_handled_on_ok_hosts,
'services_unknown_unhandled' => $this->statusSummary->services_unknown_unhandled_on_ok_hosts,
'services_unknown_passive' => $this->statusSummary->services_unknown_passive_on_ok_hosts,
'services_unknown_not_checked' => $this->statusSummary->services_unknown_not_checked_on_ok_hosts
)
); ?>
<?php endif ?>
</td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>

View File

@ -1,179 +1,46 @@
<div class="box problem_hosts"> <div class="box problem_hosts <?php
<h2><?= $this->translate('Problem Hosts'); ?></h2> echo $this->statusSummary->hosts_down ? 'state_down' : 'state_unreachable';
if (!$this->statusSummary->hosts_down_unhandled && !$this->statusSummary->hosts_unreachable_unhandled) {
echo ' handled';
}
?>">
<?php if ($this->statusSummary->hosts_down): ?>
<h2>
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 1)); ?>">
<?= sprintf($this->translate('%d Hosts DOWN'), $this->statusSummary->hosts_down); ?>
</a>
</h2>
<?php endif ?>
<?php if ($this->statusSummary->hosts_unreachable): ?>
<h2>
<a href="<?= $this->href('monitoring/list/hosts', array('host_state' => 2)); ?>">
<?= sprintf($this->translate('%d Hosts UNREACHABLE'), $this->statusSummary->hosts_unreachable); ?>
</a>
</h2>
<?php endif ?>
<div class="box contents"> <div class="box contents">
<table> <strong><?= $this->translate('Services'); ?></strong>
<thead> <?= $this->partial(
<tr> 'tactical/components/parts/servicestatesummarybyhoststate.phtml',
<th><?= $this->translate('Hosts'); ?></th> array(
<th><?= $this->translate('Services'); ?></th> 'host_problem' => 1,
</tr> 'services_ok' => $this->statusSummary->services_ok_on_problem_hosts,
</thead> 'services_ok_not_checked' => $this->statusSummary->services_ok_not_checked_on_problem_hosts,
<tbody> 'services_pending' => $this->statusSummary->services_pending_on_problem_hosts,
<tr> 'services_pending_not_checked' => $this->statusSummary->services_pending_not_checked_on_problem_hosts,
<td> 'services_warning_handled' => $this->statusSummary->services_warning_handled_on_problem_hosts,
<?php if ($this->statusSummary->hosts_down_handled || $this->statusSummary->hosts_down_unhandled): ?> 'services_warning_unhandled' => $this->statusSummary->services_warning_unhandled_on_problem_hosts,
<div class="box entry state_down <?= $this->statusSummary->hosts_down_unhandled ? '' : 'handled'; ?>"> 'services_warning_passive' => $this->statusSummary->services_warning_passive_on_problem_hosts,
<?php if ($this->statusSummary->hosts_down_unhandled): ?> 'services_warning_not_checked' => $this->statusSummary->services_warning_not_checked_on_problem_hosts,
<a href="<?= $this->href( 'services_critical_handled' => $this->statusSummary->services_critical_handled_on_problem_hosts,
'monitoring/list/hosts', 'services_critical_unhandled' => $this->statusSummary->services_critical_unhandled_on_problem_hosts,
array('host_state' => 1, 'host_unhandled' => 1) 'services_critical_passive' => $this->statusSummary->services_critical_passive_on_problem_hosts,
); ?>"> 'services_critical_not_checked' => $this->statusSummary->services_critical_not_checked_on_problem_hosts,
<?= $this->statusSummary->hosts_down_unhandled; ?> DOWN 'services_unknown_handled' => $this->statusSummary->services_unknown_handled_on_problem_hosts,
</a> 'services_unknown_unhandled' => $this->statusSummary->services_unknown_unhandled_on_problem_hosts,
<?php endif ?> 'services_unknown_passive' => $this->statusSummary->services_unknown_passive_on_problem_hosts,
<?php if ($this->statusSummary->hosts_down_handled): ?> 'services_unknown_not_checked' => $this->statusSummary->services_unknown_not_checked_on_problem_hosts
<a href="<?= $this->href( )
'monitoring/list/hosts', ); ?>
array('host_state' => 1, 'host_handled' => 1)
); ?>">
<?= $this->statusSummary->hosts_down_handled . ' ' . $this->statusSummary->hosts_down_unhandled ? $this->translate('Acknowledged') : 'DOWN'; ?>
</a>
<?php endif ?>
<?php if ($this->statusSummary->hosts_down_passive): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 1
)
); ?>">
<?php
if ($this->statusSummary->hosts_down_passive > 1) {
printf(
$this->translate('%d are passively checked'),
$this->statusSummary->hosts_down_passive
);
} else {
printf(
$this->translate('%d is passively checked'),
$this->statusSummary->hosts_down_passive
);
}
?>
</a>
<?php endif ?>
<?php if ($this->statusSummary->hosts_down_not_checked): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 1,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 0
)
); ?>">
<?php
if ($this->statusSummary->hosts_down_not_checked > 1) {
printf(
$this->translate('%d are not checked at all'),
$this->statusSummary->hosts_down_not_checked
);
} else {
printf(
$this->translate('%d is not checked at all'),
$this->statusSummary->hosts_down_not_checked
);
}
?>
</a>
<?php endif ?>
</div>
<?php endif ?>
<?php if ($this->statusSummary->hosts_unreachable_handled || $this->statusSummary->hosts_unreachable_unhandled): ?>
<div class="box entry state_unreachable <?= $this->statusSummary->hosts_unreachable_unhandled ? '' : 'handled'; ?>">
<?php if ($this->statusSummary->hosts_unreachable_unhandled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array('host_state' => 2, 'host_unhandled' => 1)
); ?>">
<?= $this->statusSummary->hosts_unreachable_unhandled; ?> UNREACHABLE
</a>
<?php endif ?>
<?php if ($this->statusSummary->hosts_unreachable_handled): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array('host_state' => 2, 'host_handled' => 1)
); ?>">
<?= $this->statusSummary->hosts_unreachable . ' ' . $this->statusSummary->hosts_unreachable_unhandled ? $this->translate('Acknowledged') : 'UNREACHABLE'; ?>
</a>
<?php endif ?>
<?php if ($this->statusSummary->hosts_unreachable_passive): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 1
)
); ?>">
<?php
if ($this->statusSummary->hosts_unreachable_passive > 1) {
printf(
$this->translate('%d are passively checked'),
$this->statusSummary->hosts_unreachable_passive
);
} else {
printf(
$this->translate('%d is passively checked'),
$this->statusSummary->hosts_unreachable_passive
);
}
?>
</a>
<?php endif ?>
<?php if ($this->statusSummary->hosts_unreachable_not_checked): ?>
<a href="<?= $this->href(
'monitoring/list/hosts',
array(
'host_state' => 2,
'host_active_checks_enabled' => 0,
'host_passive_checks_enabled' => 0
)
); ?>">
<?php
if ($this->statusSummary->hosts_unreachable_not_checked > 1) {
printf(
$this->translate('%d are not checked at all'),
$this->statusSummary->hosts_unreachable_not_checked
);
} else {
printf(
$this->translate('%d is not checked at all'),
$this->statusSummary->hosts_unreachable_not_checked
);
}
?>
</a>
<?php endif ?>
</div>
<?php endif ?>
</td>
<td>
<?= $this->partial(
'tactical/components/parts/servicestatesummarybyhoststate.phtml',
array(
'host_problem' => 1,
'services_ok' => $this->statusSummary->services_ok_on_problem_hosts,
'services_ok_not_checked' => $this->statusSummary->services_ok_not_checked_on_problem_hosts,
'services_pending' => $this->statusSummary->services_pending_on_problem_hosts,
'services_pending_not_checked' => $this->statusSummary->services_pending_not_checked_on_problem_hosts,
'services_warning_handled' => $this->statusSummary->services_warning_handled_on_problem_hosts,
'services_warning_unhandled' => $this->statusSummary->services_warning_unhandled_on_problem_hosts,
'services_warning_passive' => $this->statusSummary->services_warning_passive_on_problem_hosts,
'services_warning_not_checked' => $this->statusSummary->services_warning_not_checked_on_problem_hosts,
'services_critical_handled' => $this->statusSummary->services_critical_handled_on_problem_hosts,
'services_critical_unhandled' => $this->statusSummary->services_critical_unhandled_on_problem_hosts,
'services_critical_passive' => $this->statusSummary->services_critical_passive_on_problem_hosts,
'services_critical_not_checked' => $this->statusSummary->services_critical_not_checked_on_problem_hosts,
'services_unknown_handled' => $this->statusSummary->services_unknown_handled_on_problem_hosts,
'services_unknown_unhandled' => $this->statusSummary->services_unknown_unhandled_on_problem_hosts,
'services_unknown_passive' => $this->statusSummary->services_unknown_passive_on_problem_hosts,
'services_unknown_not_checked' => $this->statusSummary->services_unknown_not_checked_on_problem_hosts
)
); ?>
</td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>

View File

@ -5,9 +5,12 @@
<?php endif ?> <?php endif ?>
<div class="content tactical"> <div class="content tactical">
<div class="boxview" data-base-target="_next"> <div class="boxview" data-base-target="_next">
<?php if ($this->statusSummary->hosts_down || $this->statusSummary->hosts_unreachable): ?>
<?= $this->render('tactical/components/problem_hosts.phtml'); ?> <?= $this->render('tactical/components/problem_hosts.phtml'); ?>
<?php endif ?>
<?php if ($this->statusSummary->hosts_up || $this->statusSummary->hosts_pending): ?>
<?= $this->render('tactical/components/ok_hosts.phtml'); ?> <?= $this->render('tactical/components/ok_hosts.phtml'); ?>
<br /> <?php endif ?>
<?= $this->render('tactical/components/hostservicechecks.phtml'); ?> <?= $this->render('tactical/components/hostservicechecks.phtml'); ?>
<?= $this->render('tactical/components/monitoringfeatures.phtml'); ?> <?= $this->render('tactical/components/monitoringfeatures.phtml'); ?>
</div> </div>

View File

@ -237,23 +237,36 @@ a.critical {
/* Box caption */ /* Box caption */
.boxview div.box h2 { .boxview div.box h2 {
margin-top: 0.2em;
margin-bottom: 0.6em;
color: white;
font-weight: bold;
}
.boxview div.box h3 {
margin-top: 0; margin-top: 0;
margin-bottom: 0.6em; margin-bottom: 0.6em;
font-size: 0.8em; font-size: 0.8em;
color: #eee; color: #eee;
} }
.boxview div.box h2:first-child {
margin-top: 0.2em;
font-size: inherit;
color: white;
}
.boxview div.box h2 > a {
color: inherit;
}
.boxview div.box h2 > a:hover {
color: #fafafa;
}
.boxview div.box h2:first-child > a:hover {
color: #dfdfdf;
}
/* Box body of contents */ /* Box body of contents */
.boxview div.box.contents { .boxview div.box.contents {
padding: 0.2em;
background: #fbfbfb; background: #fbfbfb;
border-radius: 0.4em; border-radius: 0.4em;
-moz-border-radius: 0.4em; -moz-border-radius: 0.4em;
@ -377,8 +390,64 @@ div.box.entry.handled a:hover {
/* Tactical overview element styles */ /* Tactical overview element styles */
div.tactical div.box { .tactical > .boxview > div.box {
min-height: 15em; min-height: 17em;
}
.tactical div.box.contents {
min-height: 14.5em;
}
div.box.contents.zero {
min-width: 11.1em;
background-color: transparent;
}
div.box.contents.zero span {
font-weight: bold;
color: white;
}
div.box.contents.zero h3 {
margin: 0;
font-size: 12em;
line-height: 1em;
color: white;
}
div.box.ok_hosts.state_up {
background-color: @colorOk;
}
div.box.ok_hosts.state_pending {
background-color: @colorPending;
}
div.box.problem_hosts.state_down {
background-color: @colorCritical;
}
div.box.problem_hosts.state_down.handled {
background-color: @colorCriticalHandled;
}
div.box.problem_hosts.state_unreachable {
background-color: @colorUnreachable;
}
div.box.problem_hosts.state_unreachable.handled {
background-color: @colorUnreachableHandled;
}
div.box.ok_hosts div.box.entry, div.box.problem_hosts div.box.entry {
min-width: 11.1em;
}
div.box.monitoringfeatures div.box.contents {
padding: 0 0 0.4em;
} }
div.box.monitoringfeatures div.box-separator { div.box.monitoringfeatures div.box-separator {

View File

@ -49,6 +49,7 @@
) { ) {
this.enabled = true; this.enabled = true;
this.icinga.logger.debug('History API enabled'); this.icinga.logger.debug('History API enabled');
this.applyLocationBar();
$(window).on('popstate', { self: this }, this.onHistoryChange); $(window).on('popstate', { self: this }, this.onHistoryChange);
} }
@ -98,9 +99,7 @@
var self = event.data.self, var self = event.data.self,
icinga = self.icinga, icinga = self.icinga,
onload, onload;
main,
parts;
icinga.logger.debug('Got a history change'); icinga.logger.debug('Got a history change');
@ -117,6 +116,15 @@
icinga.logger.debug('History state', event.originalEvent.state); icinga.logger.debug('History state', event.originalEvent.state);
} }
self.applyLocationBar();
},
applyLocationBar: function () {
var icinga = this.icinga,
main,
parts;
// TODO: Still hardcoding col1/col2, shall be dynamic soon // TODO: Still hardcoding col1/col2, shall be dynamic soon
main = document.location.pathname + document.location.search; main = document.location.pathname + document.location.search;
if ($('#col1').data('icingaUrl') !== main) { if ($('#col1').data('icingaUrl') !== main) {
@ -145,7 +153,6 @@
// TODO: Replace with dynamic columns // TODO: Replace with dynamic columns
icinga.ui.layout1col(); icinga.ui.layout1col();
} }
}, },
/** /**