Merge branch 'bugfix/calculate-states-for-host-group-view-from-host-states-8860'
fixes #8860
This commit is contained in:
commit
0fe15d655b
|
@ -528,6 +528,12 @@ class Monitoring_ListController extends Controller
|
|||
'hosts_down_handled',
|
||||
'hosts_down_unhandled',
|
||||
'hosts_pending',
|
||||
'hosts_up_last_state_change',
|
||||
'hosts_pending_last_state_change',
|
||||
'hosts_down_last_state_change_handled',
|
||||
'hosts_unreachable_last_state_change_handled',
|
||||
'hosts_down_last_state_change_unhandled',
|
||||
'hosts_unreachable_last_state_change_unhandled',
|
||||
'services_ok',
|
||||
'services_unknown_handled',
|
||||
'services_unknown_unhandled',
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php if (! $this->compact): ?>
|
||||
<?php
|
||||
use Icinga\Module\Monitoring\Object\Host;
|
||||
|
||||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs; ?>
|
||||
<?= $this->sortBox; ?>
|
||||
|
@ -15,7 +18,7 @@ if (count($hostgroups) === 0) {
|
|||
return;
|
||||
}
|
||||
?>
|
||||
<table class="groupview" data-base-target="_next">
|
||||
<table class="groupview action" data-base-target="_next">
|
||||
<thead>
|
||||
<th><?= $this->translate('Last Problem'); ?></th>
|
||||
<th><?= $this->translate('Host Group'); ?></th>
|
||||
|
@ -23,57 +26,40 @@ if (count($hostgroups) === 0) {
|
|||
<th><?= $this->translate('Service States'); ?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($hostgroups as $h): ?>
|
||||
<tr href="<?= $this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name)) ?>">
|
||||
<?php if ($h->services_critical_last_state_change_unhandled): ?>
|
||||
<td class="state change critical unhandled">
|
||||
<strong><?= $this->translate('CRITICAL'); ?></strong>
|
||||
<?php foreach ($hostgroups as $h):
|
||||
if ($h->hosts_down_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_unhandled;
|
||||
} elseif ($h->hosts_unreachable_unhandled) {
|
||||
$handled = false;
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_unhandled;
|
||||
} else {
|
||||
$handled = true;
|
||||
if ($h->hosts_down_handled) {
|
||||
$state = Host::STATE_DOWN;
|
||||
$lastStateChange = $h->hosts_down_last_state_change_handled;
|
||||
} elseif ($h->hosts_unreachable_handled) {
|
||||
$state = Host::STATE_UNREACHABLE;
|
||||
$lastStateChange = $h->hosts_unreachable_last_state_change_handled;
|
||||
} elseif ($h->hosts_up) {
|
||||
$state = Host::STATE_UP;
|
||||
$lastStateChange = $h->hosts_up_last_state_change;
|
||||
} else {
|
||||
$state = Host::STATE_PENDING;
|
||||
$lastStateChange = $h->hosts_pending_last_state_change;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr class="state <?= Host::getStateText($state) ?><?= $handled ? ' handled' : '' ?>" href="<?=
|
||||
$this->href('monitoring/list/hosts', array('hostgroup_name' => $h->hostgroup_name))
|
||||
?>">
|
||||
<td class="state">
|
||||
<strong><?= Host::getStateText($state, true); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_critical_last_state_change_unhandled); ?>
|
||||
<?= $this->prefixedTimeSince($lastStateChange); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_unknown_last_state_change_unhandled): ?>
|
||||
<td class="state change unknown unhandled">
|
||||
<strong><?= $this->translate('UNKNOWN'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_unknown_last_state_change_unhandled); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_warning_last_state_change_unhandled): ?>
|
||||
<td class="state change warning unhandled">
|
||||
<strong><?= $this->translate('WARNING'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_warning_last_state_change_unhandled); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_critical_last_state_change_handled): ?>
|
||||
<td class="state change critical">
|
||||
<strong><?= $this->translate('CRITICAL'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_critical_last_state_change_handled); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_unknown_last_state_change_handled): ?>
|
||||
<td class="state change unknown">
|
||||
<strong><?= $this->translate('UNKNOWN'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_unknown_last_state_change_handled); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_warning_last_state_change_handled): ?>
|
||||
<td class="state change warning">
|
||||
<strong><?= $this->translate('WARNING'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_warning_last_state_change_handled); ?>
|
||||
</td>
|
||||
<?php elseif ($h->services_ok_last_state_change): ?>
|
||||
<td class="state change ok">
|
||||
<strong><?= $this->translate('OK'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_ok_last_state_change); ?>
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td class="state change pending">
|
||||
<strong><?= $this->translate('PENDING'); ?></strong>
|
||||
<br>
|
||||
<?= $this->prefixedTimeSince($h->services_pending_last_state_change); ?>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
<td class="groupname">
|
||||
<?= $this->qlink(
|
||||
$h->hostgroup_alias,
|
||||
|
@ -93,7 +79,7 @@ if (count($hostgroups) === 0) {
|
|||
))
|
||||
); ?>
|
||||
</td>
|
||||
<td class="state">
|
||||
<td>
|
||||
<?php if ($h->services_ok): ?>
|
||||
<span class="state ok">
|
||||
<?= $this->qlink(
|
||||
|
|
|
@ -11,17 +11,23 @@ class GroupSummaryQuery extends IdoQuery
|
|||
|
||||
protected $columnMap = array(
|
||||
'hoststatussummary' => array(
|
||||
'hosts_up' => 'SUM(CASE WHEN object_type = \'host\' AND state = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)',
|
||||
'hostgroup_name' => 'hostgroup_name',
|
||||
'hostgroup_alias' => 'hostgroup_alias',
|
||||
'hostgroup' => 'hostgroup'
|
||||
'hosts_up' => 'SUM(CASE WHEN object_type = \'host\' AND state = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_unreachable_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_handled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime != 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_down_unhandled' => 'SUM(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN 1 ELSE 0 END)',
|
||||
'hosts_pending' => 'SUM(CASE WHEN object_type = \'host\' AND state = 99 THEN 1 ELSE 0 END)',
|
||||
'hosts_up_last_state_change' => 'MAX(CASE WHEN object_type = \'host\' AND state = 0 THEN state_change ELSE 0 END)',
|
||||
'hosts_pending_last_state_change' => 'MAX(CASE WHEN object_type = \'host\' AND state = 99 THEN state_change ELSE 0 END)',
|
||||
'hosts_down_last_state_change_handled' => 'MAX(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime != 0 THEN state_change ELSE 0 END)',
|
||||
'hosts_unreachable_last_state_change_handled' => 'MAX(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime != 0 THEN state_change ELSE 0 END)',
|
||||
'hosts_down_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'host\' AND state = 1 AND acknowledged + in_downtime = 0 THEN state_change ELSE 0 END)',
|
||||
'hosts_unreachable_last_state_change_unhandled' => 'MAX(CASE WHEN object_type = \'host\' AND state = 2 AND acknowledged + in_downtime = 0 THEN state_change ELSE 0 END)',
|
||||
'hostgroup_name' => 'hostgroup_name',
|
||||
'hostgroup_alias' => 'hostgroup_alias',
|
||||
'hostgroup' => 'hostgroup'
|
||||
),
|
||||
'servicestatussummary' => array(
|
||||
'services_total' => 'SUM(CASE WHEN object_type = \'service\' THEN 1 ELSE 0 END)',
|
||||
|
|
|
@ -25,6 +25,12 @@ class Groupsummary extends DataView
|
|||
'hosts_down_handled',
|
||||
'hosts_down_unhandled',
|
||||
'hosts_pending',
|
||||
'hosts_up_last_state_change',
|
||||
'hosts_pending_last_state_change',
|
||||
'hosts_down_last_state_change_handled',
|
||||
'hosts_unreachable_last_state_change_handled',
|
||||
'hosts_down_last_state_change_unhandled',
|
||||
'hosts_unreachable_last_state_change_unhandled',
|
||||
'services_total',
|
||||
'services_ok',
|
||||
'services_unknown',
|
||||
|
|
Loading…
Reference in New Issue