parent
2591f055d8
commit
9c45e99b57
|
@ -111,14 +111,19 @@ class Monitoring_HostsController extends Controller
|
|||
$objectsInDowntime = array();
|
||||
$downtimeFilterExpressions = array();
|
||||
$hostStates = array(
|
||||
Host::getStateText(Host::STATE_UP) => 0,
|
||||
Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_UP) => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_UP) . '_unhandled' => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_DOWN) => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_DOWN) . '_unhandled' => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_UNREACHABLE) => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_UNREACHABLE) . '_unhandled' => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_PENDING) => 0,
|
||||
'hosts_' . Host::getStateText(Host::STATE_PENDING) . '_unhandled' => 0,
|
||||
);
|
||||
foreach ($this->hostList as $host) {
|
||||
/** @var Host $host */
|
||||
if ((bool) $host->problem === true && (bool) $host->handled === false) {
|
||||
$unhandled = (bool) $host->problem === true && (bool) $host->handled === false;
|
||||
if ($unhandled) {
|
||||
$unhandledObjects[] = $host;
|
||||
$unhandledFilterExpressions[] = Filter::where('host', $host->getName());
|
||||
}
|
||||
|
@ -129,7 +134,7 @@ class Monitoring_HostsController extends Controller
|
|||
$objectsInDowntime[] = $host;
|
||||
$downtimeFilterExpressions[] = Filter::where('downtime_host', $host->getName());
|
||||
}
|
||||
++$hostStates[$host::getStateText($host->state)];
|
||||
++$hostStates['hosts_' . $host::getStateText($host->state) . ($unhandled ? '_unhandled' : '')];
|
||||
}
|
||||
if (! empty($acknowledgedObjects)) {
|
||||
$removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
|
@ -145,7 +150,7 @@ class Monitoring_HostsController extends Controller
|
|||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
|
||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
|
||||
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/hosts/delete-comment');
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->hostStates = (object)$hostStates;
|
||||
$this->view->objects = $this->hostList;
|
||||
$this->view->unhandledObjects = $unhandledObjects;
|
||||
$unhandledFilterQueryString = Filter::matchAny($unhandledFilterExpressions)->toQueryString();
|
||||
|
|
|
@ -8,12 +8,7 @@ use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
|||
<?= $tabs; ?>
|
||||
<?php endif ?>
|
||||
|
||||
<h1>
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('%d Hosts Selected'), count($objects)),
|
||||
$listAllLink
|
||||
); ?>
|
||||
</h1>
|
||||
<?= $this->render('partials/host/objects-tinysummary.phtml') ?>
|
||||
<?= $this->render('partials/host/objects-header.phtml'); ?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
use Icinga\Module\Monitoring\Object\Host;
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$i = 0;
|
||||
$hidden = array();
|
||||
$hiddenRich = array();
|
||||
?>
|
||||
|
||||
|
||||
<?php if (($hostCount = count($objects)) > 0): ?>
|
||||
|
||||
<p>
|
||||
|
@ -71,8 +69,8 @@ $hiddenRich = array();
|
|||
|
||||
<?php if (count($hidden)): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="selection-info" data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
|
||||
<td class="state">
|
||||
<div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
|
||||
title="<?= join(', ', $hidden) ?>">
|
||||
<?= sprintf($this->translate('%d more ...'), count($hidden)) ?>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
use Icinga\Web\Url;
|
||||
?>
|
||||
|
||||
<h1 class="tinystatesummary">
|
||||
<?= $this->qlink(
|
||||
sprintf($this->translate('%d Hosts Selected:'), count($objects)),
|
||||
$listAllLink
|
||||
); ?>
|
||||
|
||||
<span class="badges">
|
||||
<?php if ($hostStates->hosts_up): ?>
|
||||
|
||||
<?php $selfUrl = Url::fromPath('monitoring/list/hosts'); ?>
|
||||
<span class="state up"><b>
|
||||
<?= $hostStates->hosts_up ?>
|
||||
</b></span>
|
||||
<?php endif ?>
|
||||
|
||||
|
||||
<?php
|
||||
foreach (
|
||||
array(
|
||||
1 => 'down',
|
||||
2 => 'unreachable',
|
||||
99 => 'pending'
|
||||
) as $stateId => $state) {
|
||||
|
||||
$stateName = 'hosts_' . $state;
|
||||
$unhandledStateName = $stateName . '_unhandled';
|
||||
if ($hostStates->$unhandledStateName) {
|
||||
echo '<span class="state ' . $state . '"><b>' . $hostStates->$unhandledStateName . '</b>';
|
||||
}
|
||||
if ($hostStates->$stateName) {
|
||||
echo '<span class="state ' . $state . ' handled"><b>' . $hostStates->$stateName . '</b></span>';
|
||||
}
|
||||
if ($hostStates->$unhandledStateName) {
|
||||
echo '</span>';
|
||||
}
|
||||
$stateName .= '_unhandled';
|
||||
}?>
|
||||
|
||||
</span>
|
||||
</h1>
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
use Icinga\Module\Monitoring\Object\Service;
|
||||
use Icinga\Web\Url;
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
|
|
@ -129,14 +129,26 @@ span.state.ok {
|
|||
background: @colorOk;
|
||||
}
|
||||
|
||||
span.state.up {
|
||||
background: @colorOk;
|
||||
}
|
||||
|
||||
span.state.critical {
|
||||
background: @colorCritical;
|
||||
}
|
||||
|
||||
span.state.down {
|
||||
background: @colorCritical;
|
||||
}
|
||||
|
||||
span.state.handled.critical {
|
||||
background: @colorCriticalHandled;
|
||||
}
|
||||
|
||||
span.state.handled.down {
|
||||
background: @colorCriticalHandled;
|
||||
}
|
||||
|
||||
span.state.warning {
|
||||
background: @colorWarning;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue