parent
878ef05896
commit
0312d8d6da
|
@ -82,19 +82,14 @@ class Monitoring_HostsController extends Controller
|
|||
->setRedirectUrl(Url::fromPath('monitoring/hosts/show')->setParams($this->params))
|
||||
->handleRequest();
|
||||
|
||||
$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,
|
||||
);
|
||||
foreach ($this->hostList as $host) {
|
||||
++$hostStates[$host::getStateText($host->state)];
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->objects = $this->hostList;
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->stats = $this->hostList->getStateSummary();
|
||||
$this->view->hostStatesPieChart = InlinePie::createFromStateSummary(
|
||||
$this->view->stats,
|
||||
$this->translate('Host State'),
|
||||
InlinePie::$colorsHostStatesHandledUnhandled
|
||||
);
|
||||
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
|
||||
return $form;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,10 @@ class Monitoring_ServicesController extends Controller
|
|||
{
|
||||
$this->serviceList->setColumns(array(
|
||||
'host_name',
|
||||
'host_output',
|
||||
'host_state',
|
||||
'host_problem',
|
||||
'host_handled',
|
||||
'service_description',
|
||||
'service_state',
|
||||
'service_problem',
|
||||
|
@ -83,32 +86,21 @@ class Monitoring_ServicesController extends Controller
|
|||
->setRedirectUrl(Url::fromPath('monitoring/services/show')->setParams($this->params))
|
||||
->handleRequest();
|
||||
|
||||
$serviceStates = array(
|
||||
Service::getStateText(Service::STATE_OK) => 0,
|
||||
Service::getStateText(Service::STATE_WARNING) => 0,
|
||||
Service::getStateText(Service::STATE_CRITICAL) => 0,
|
||||
Service::getStateText(Service::STATE_UNKNOWN) => 0,
|
||||
Service::getStateText(Service::STATE_PENDING) => 0
|
||||
);
|
||||
$knownHostStates = 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,
|
||||
);
|
||||
foreach ($this->serviceList as $service) {
|
||||
++$serviceStates[$service::getStateText($service->state)];
|
||||
if (! isset($knownHostStates[$service->getHost()->getName()])) {
|
||||
$knownHostStates[$service->getHost()->getName()] = true;
|
||||
++$hostStates[$service->getHost()->getStateText($service->host_state)];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
$this->view->objects = $this->serviceList;
|
||||
$this->view->serviceStates = $serviceStates;
|
||||
$this->view->hostStates = $hostStates;
|
||||
$this->view->stats = $this->serviceList->getServiceStateSummary();
|
||||
$this->view->serviceStates = true;
|
||||
$this->view->serviceStatesPieChart = InlinePie::createFromStateSummary(
|
||||
$this->view->stats,
|
||||
$this->translate('Service State'),
|
||||
InlinePie::$colorsServiceStatesHandleUnhandled
|
||||
);
|
||||
$this->view->hostStates = $this->serviceList->getHostStateSummary();
|
||||
$this->view->hostStatesPieChart = InlinePie::createFromStateSummary(
|
||||
$this->view->hostStates,
|
||||
$this->translate('Service State'),
|
||||
InlinePie::$colorsHostStatesHandledUnhandled
|
||||
);
|
||||
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
|
||||
return $form;
|
||||
}
|
||||
|
@ -168,15 +160,6 @@ class Monitoring_ServicesController extends Controller
|
|||
$this->translate('Host State'),
|
||||
InlinePie::$colorsHostStatesHandledUnhandled
|
||||
);
|
||||
/*
|
||||
if (! empty($objectsInDowntime)) {
|
||||
$removeDowntimeForm = new DeleteDowntimeCommandForm();
|
||||
$removeDowntimeForm
|
||||
->setObjects($objectsInDowntime)
|
||||
->handleRequest();
|
||||
$this->view->removeDowntimeForm = $removeDowntimeForm;
|
||||
}
|
||||
*/
|
||||
$this->setAutorefreshInterval(15);
|
||||
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/services/reschedule-check');
|
||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/services/schedule-downtime');
|
||||
|
|
|
@ -5,13 +5,6 @@
|
|||
<?php endif ?>
|
||||
|
||||
<?= $this->render('list/components/hostssummary.phtml') ?>
|
||||
|
||||
<br>
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('States:') ?>
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('partials/host/objects-header.phtml'); ?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,6 @@ function urlAddFilterOptional($url, $filter, $optional) {
|
|||
return $url->setQueryString($f->toQueryString());
|
||||
}
|
||||
$this->baseFilter = isset($this->baseFilter) ? $this->baseFilter : null;
|
||||
|
||||
$selfUrl = 'monitoring/list/hosts';
|
||||
$currentUrl = Url::fromRequest()->getRelativeUrl();
|
||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
<?php endif ?>
|
||||
|
||||
<?php if (isset($serviceStates)): ?>
|
||||
<h1><?= sprintf($this->translate('%d Services Selected'), count($objects)) ?></h1>
|
||||
<?= $this->render('list/components/servicesummary.phtml') ?>
|
||||
<?= $this->render('partials/service/objects-header.phtml'); ?>
|
||||
<?php else: ?>
|
||||
<h1><?= sprintf($this->translate('%d Hosts Selected'), count($objects)) ?></h1>
|
||||
<?= $this->render('list/components/hostssummary.phtml') ?>
|
||||
<?= $this->render('partials/host/objects-header.phtml'); ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
|
|
@ -8,6 +8,11 @@ $hidden = array();
|
|||
$hiddenRich = array();
|
||||
?>
|
||||
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('States:') ?>
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
|
||||
<?php if (($hostCount = count($objects)) > 0): ?>
|
||||
|
||||
<p>
|
||||
|
@ -61,7 +66,8 @@ $hiddenRich = array();
|
|||
|
||||
<tr>
|
||||
<td class="state">
|
||||
<div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
|
||||
<div <?= count($hidden) ?
|
||||
'data-title-rich="<span align=\'left\'>' . join('<br>', $hiddenRich) . '</span>"' : ''; ?>
|
||||
title="<?= join(', ', $hidden) ?>">
|
||||
<?php
|
||||
echo $this->qlink(
|
||||
|
|
|
@ -2,6 +2,15 @@
|
|||
use Icinga\Module\Monitoring\Object\Service;
|
||||
?>
|
||||
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('Service states:') ?>
|
||||
<?= $serviceStatesPieChart; ?>
|
||||
</div>
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('Host states:') ?>
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$i = 0;
|
||||
$hidden = array();
|
||||
|
@ -14,19 +23,22 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php foreach ($objects as $service): /** @var Service $service */ ?>
|
||||
<?php
|
||||
$i++;
|
||||
if ($i > 5) {
|
||||
if ($i > 5 && $i < 20) {
|
||||
$desc = $service->getName() . ' on ' . $service->getHost()->getName();
|
||||
$hidden[] = $desc;
|
||||
$hiddenRich[] = sprintf("<div class='color-box badge-%s'></div>%s", $service->getStateText($service->service_state) ,$desc);
|
||||
}
|
||||
if ($i == 20) {
|
||||
$hiddenRich[] = '...';
|
||||
}
|
||||
if ($i > 5) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr class="state <?= Service::getStateText($service->service_state); ?><?= $service->service_handled ? ' handled' : '' ?>">
|
||||
<td class="state"><?= Service::getStateText($service->service_state, true); ?><br /></td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php if (!$service->service_handled && $service->service_state > 0): ?>
|
||||
<?= $this->icon('attention-alt', $this->translate('Unhandled')) ?>
|
||||
<?php endif ?>
|
||||
|
@ -52,7 +64,6 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
<?php if (isset($service->service_last_comment) && $service->service_last_comment !== null): ?>
|
||||
<?= $this->icon('comment', $this->translate('Last Comment: ') . $service->service_last_comment) ?>
|
||||
<?php endif ?>
|
||||
|
||||
</td>
|
||||
<td class="name oneline"><?= $this->escape($service->getName()); ?></td>
|
||||
<td class="name oneline"><?= $this->escape($service->getHost()->getName()); ?></b></td>
|
||||
|
@ -62,7 +73,8 @@ use Icinga\Module\Monitoring\Object\Service;
|
|||
|
||||
<tr>
|
||||
<td class="state">
|
||||
<div data-title-rich="<span align='left'><?= join('<br>', $hiddenRich) ?></span>"
|
||||
<div <?= count($hidden) ?
|
||||
'data-title-rich="<span align=\'left\'>' . join('<br>', $hiddenRich) . '</span>"' : ''; ?>
|
||||
title="<?= join(', ', $hidden) ?>">
|
||||
|
||||
<?php
|
||||
|
|
|
@ -5,16 +5,6 @@
|
|||
<?php endif ?>
|
||||
|
||||
<?= $this->render('list/components/servicesummary.phtml') ?>
|
||||
<br>
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('Service states:') ?>
|
||||
<?= $serviceStatesPieChart; ?>
|
||||
</div>
|
||||
<div class="hbox-item">
|
||||
<?= $this->translate('Host states:') ?>
|
||||
<?= $hostStatesPieChart; ?>
|
||||
</div>
|
||||
|
||||
<?= $this->render('partials/service/objects-header.phtml'); ?>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -345,6 +345,7 @@ html {
|
|||
.hbox-item {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.25em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
|
|
Loading…
Reference in New Issue