commit
3e29046f56
|
@ -133,6 +133,8 @@ class Monitoring_HostsController extends Controller
|
||||||
$this->view->objects = $this->hostList;
|
$this->view->objects = $this->hostList;
|
||||||
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
$this->view->unhandledObjects = $this->hostList->getUnhandledObjects();
|
||||||
$this->view->problemObjects = $this->hostList->getProblemObjects();
|
$this->view->problemObjects = $this->hostList->getProblemObjects();
|
||||||
|
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')
|
||||||
|
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||||
$this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
$this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||||
|
|
|
@ -78,20 +78,6 @@ class Monitoring_ShowController extends Controller
|
||||||
$this->setupPaginationControl($this->view->history, 50);
|
$this->setupPaginationControl($this->view->history, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function servicesAction()
|
|
||||||
{
|
|
||||||
$this->setAutorefreshInterval(15);
|
|
||||||
$this->getTabs()->activate('services');
|
|
||||||
$this->_setParam('service', '');
|
|
||||||
// TODO: This used to be a hack and still is. Modifying query string here.
|
|
||||||
$_SERVER['QUERY_STRING'] = (string) $this->params->without('service')->set('limit', '');
|
|
||||||
$this->view->services = $this->view->action('services', 'list', 'monitoring', array(
|
|
||||||
'view' => 'compact',
|
|
||||||
'sort' => 'service_description',
|
|
||||||
));
|
|
||||||
$this->fetchHostStats();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function fetchHostStats()
|
protected function fetchHostStats()
|
||||||
{
|
{
|
||||||
$this->view->stats = $this->backend->select()->from('statusSummary', array(
|
$this->view->stats = $this->backend->select()->from('statusSummary', array(
|
||||||
|
@ -228,19 +214,6 @@ class Monitoring_ShowController extends Controller
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$tabs->add(
|
|
||||||
'services',
|
|
||||||
array(
|
|
||||||
'title' => sprintf(
|
|
||||||
$this->translate('List all services on host %s'),
|
|
||||||
$isService ? $object->getHost()->getName() : $object->getName()
|
|
||||||
),
|
|
||||||
'label' => $this->translate('Services'),
|
|
||||||
'icon' => 'services',
|
|
||||||
'url' => 'monitoring/show/services',
|
|
||||||
'urlParams' => $params,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($this->backend->hasQuery('eventHistory')) {
|
if ($this->backend->hasQuery('eventHistory')) {
|
||||||
$tabs->add(
|
$tabs->add(
|
||||||
'history',
|
'history',
|
||||||
|
|
|
@ -69,7 +69,7 @@ if (count($hosts) === 0) {
|
||||||
$this->translatePlural('%u unhandled service', '%u unhandled services', $host->host_unhandled_services),
|
$this->translatePlural('%u unhandled service', '%u unhandled services', $host->host_unhandled_services),
|
||||||
$host->host_unhandled_services
|
$host->host_unhandled_services
|
||||||
),
|
),
|
||||||
'monitoring/show/services',
|
'monitoring/list/services',
|
||||||
array(
|
array(
|
||||||
'host' => $host->host_name,
|
'host' => $host->host_name,
|
||||||
'service_problem' => 1,
|
'service_problem' => 1,
|
||||||
|
|
|
@ -67,7 +67,7 @@ foreach ($serviceDescriptions as $service_description): ?>
|
||||||
<th>
|
<th>
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
$host_name,
|
$host_name,
|
||||||
'monitoring/show/services?' . $serviceFilter,
|
'monitoring/list/services?' . $serviceFilter,
|
||||||
array('host' => $host_name),
|
array('host' => $host_name),
|
||||||
array('title' => sprintf($this->translate('List all reported services on host %s'), $host_name))
|
array('title' => sprintf($this->translate('List all reported services on host %s'), $host_name))
|
||||||
); ?>
|
); ?>
|
||||||
|
|
|
@ -12,8 +12,7 @@ function urlAddFilterOptional($url, $filter, $optional) {
|
||||||
return $url->setQueryString($f->toQueryString());
|
return $url->setQueryString($f->toQueryString());
|
||||||
}
|
}
|
||||||
|
|
||||||
$selfUrl = Url::fromPath('monitoring/show/services', array('host' => $object->host_name));
|
$selfUrl = Url::fromPath('monitoring/list/services', array('host' => $object->host_name));
|
||||||
$currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
|
||||||
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
?><div class="tinystatesummary" <?= $this->compact ? ' data-base-target="col1"' : ''; ?>>
|
||||||
<?php if ($object->stats->services_total): ?>
|
<?php if ($object->stats->services_total): ?>
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
|
@ -27,15 +26,18 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
||||||
),
|
),
|
||||||
$selfUrl,
|
$selfUrl,
|
||||||
null,
|
null,
|
||||||
array('title' => sprintf(
|
array(
|
||||||
$this->translatePlural(
|
'title' => sprintf(
|
||||||
'List all %u service on host %s',
|
$this->translatePlural(
|
||||||
'List all %u services on host %s',
|
'List all %u service on host %s',
|
||||||
$object->stats->services_total
|
'List all %u services on host %s',
|
||||||
|
$object->stats->services_total
|
||||||
|
),
|
||||||
|
$object->stats->services_total,
|
||||||
|
$object->host_name
|
||||||
),
|
),
|
||||||
$object->stats->services_total,
|
'data-base-target' => '_next'
|
||||||
$object->host_name
|
)
|
||||||
))
|
|
||||||
); ?>
|
); ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?= $this->translate('No services configured on this host'); ?>
|
<?= $this->translate('No services configured on this host'); ?>
|
||||||
|
@ -43,20 +45,23 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl();
|
||||||
|
|
||||||
<span class="badges">
|
<span class="badges">
|
||||||
<?php if ($object->stats->services_ok): ?>
|
<?php if ($object->stats->services_ok): ?>
|
||||||
<span class="state ok<?= $currentUrl === $selfUrl->with('service_state', 0)->getRelativeUrl() ? ' active' : ''; ?>">
|
<span class="state ok">
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
$object->stats->services_ok,
|
$object->stats->services_ok,
|
||||||
$selfUrl,
|
$selfUrl,
|
||||||
array('service_state' => 0),
|
array('service_state' => 0),
|
||||||
array('title' => sprintf(
|
array(
|
||||||
$this->translatePlural(
|
'title' => sprintf(
|
||||||
'List %u service that is currently in state OK on host %s',
|
$this->translatePlural(
|
||||||
'List %u services which are currently in state OK on host %s',
|
'List %u service that is currently in state OK on host %s',
|
||||||
$object->stats->services_ok
|
'List %u services which are currently in state OK on host %s',
|
||||||
|
$object->stats->services_ok
|
||||||
|
),
|
||||||
|
$object->stats->services_ok,
|
||||||
|
$object->host_name
|
||||||
),
|
),
|
||||||
$object->stats->services_ok,
|
'data-base-target' => '_next'
|
||||||
$object->host_name
|
)
|
||||||
))
|
|
||||||
); ?>
|
); ?>
|
||||||
</span>
|
</span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -68,61 +73,49 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
||||||
$unhandled = $pre . '_unhandled';
|
$unhandled = $pre . '_unhandled';
|
||||||
$paramsHandled = array('service_state' => $stateId, 'service_handled' => 1);
|
$paramsHandled = array('service_state' => $stateId, 'service_handled' => 1);
|
||||||
$paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0);
|
$paramsUnhandled = array('service_state' => $stateId, 'service_handled' => 0);
|
||||||
if ($object->stats->$unhandled) {
|
echo '<span class="state ' . $state . ($object->stats->$unhandled ? '' : ' handled') . '">';
|
||||||
$compareUrl = $selfUrl->with($paramsUnhandled)->getRelativeUrl();
|
|
||||||
} else {
|
|
||||||
$compareUrl = $selfUrl->with($paramsHandled)->getRelativeUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($compareUrl === $currentUrl) {
|
|
||||||
$active = ' active';
|
|
||||||
} else {
|
|
||||||
$active = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<span class="state ' . $state . $active . ($object->stats->$unhandled ? '' : ' handled') . '">';
|
|
||||||
if ($object->stats->$unhandled) {
|
if ($object->stats->$unhandled) {
|
||||||
|
|
||||||
echo $this->qlink(
|
echo $this->qlink(
|
||||||
$object->stats->$unhandled,
|
$object->stats->$unhandled,
|
||||||
$selfUrl,
|
$selfUrl,
|
||||||
$paramsUnhandled,
|
$paramsUnhandled,
|
||||||
array('title' => sprintf(
|
array(
|
||||||
$this->translatePlural(
|
'title' => sprintf(
|
||||||
'List %u service that is currently in state %s on host %s',
|
$this->translatePlural(
|
||||||
'List %u services which are currently in state %s on host %s',
|
'List %u service that is currently in state %s on host %s',
|
||||||
$object->stats->$unhandled
|
'List %u services which are currently in state %s on host %s',
|
||||||
|
$object->stats->$unhandled
|
||||||
|
),
|
||||||
|
$object->stats->$unhandled,
|
||||||
|
Service::getStateText($stateId, true),
|
||||||
|
$object->host_name
|
||||||
),
|
),
|
||||||
$object->stats->$unhandled,
|
'data-base-target' => '_next'
|
||||||
Service::getStateText($stateId, true),
|
)
|
||||||
$object->host_name
|
|
||||||
))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($object->stats->$handled) {
|
if ($object->stats->$handled) {
|
||||||
|
|
||||||
if ($selfUrl->with($paramsHandled)->getRelativeUrl() === $currentUrl) {
|
|
||||||
$active = ' active';
|
|
||||||
} else {
|
|
||||||
$active = '';
|
|
||||||
}
|
|
||||||
if ($object->stats->$unhandled) {
|
if ($object->stats->$unhandled) {
|
||||||
echo '<span class="state handled ' . $state . $active . '">';
|
echo '<span class="state handled ' . $state . '">';
|
||||||
}
|
}
|
||||||
echo $this->qlink(
|
echo $this->qlink(
|
||||||
$object->stats->$handled,
|
$object->stats->$handled,
|
||||||
$selfUrl,
|
$selfUrl,
|
||||||
$paramsHandled,
|
$paramsHandled,
|
||||||
array('title' => sprintf(
|
array(
|
||||||
$this->translatePlural(
|
'title' => sprintf(
|
||||||
'List %u service that is currently in state %s (Acknowledged) on host %s',
|
$this->translatePlural(
|
||||||
'List %u services which are currently in state %s (Acknowledged) on host %s',
|
'List %u service that is currently in state %s (Acknowledged) on host %s',
|
||||||
$object->stats->$handled
|
'List %u services which are currently in state %s (Acknowledged) on host %s',
|
||||||
|
$object->stats->$handled
|
||||||
|
),
|
||||||
|
$object->stats->$handled,
|
||||||
|
Service::getStateText($stateId, true),
|
||||||
|
$object->host_name
|
||||||
),
|
),
|
||||||
$object->stats->$handled,
|
'data-base-target' => '_next'
|
||||||
Service::getStateText($stateId, true),
|
)
|
||||||
$object->host_name
|
|
||||||
))
|
|
||||||
);
|
);
|
||||||
if ($object->stats->$unhandled) {
|
if ($object->stats->$unhandled) {
|
||||||
echo "</span>\n";
|
echo "</span>\n";
|
||||||
|
@ -133,20 +126,23 @@ foreach (array(2 => 'critical', 3 => 'unknown', 1 => 'warning') as $stateId => $
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($object->stats->services_pending): ?>
|
<?php if ($object->stats->services_pending): ?>
|
||||||
<span class="state pending<?= $currentUrl === $selfUrl->with('service_state', 99)->getRelativeUrl() ? ' active' : ''; ?>">
|
<span class="state pending">
|
||||||
<?= $this->qlink(
|
<?= $this->qlink(
|
||||||
$object->stats->services_pending,
|
$object->stats->services_pending,
|
||||||
$selfUrl,
|
$selfUrl,
|
||||||
array('service_state' => 99),
|
array('service_state' => 99),
|
||||||
array('title' => sprintf(
|
array(
|
||||||
$this->translatePlural(
|
'title' => sprintf(
|
||||||
'List %u service that is currently in state PENDING on host %s',
|
$this->translatePlural(
|
||||||
'List %u services which are currently in state PENDING on host %s',
|
'List %u service that is currently in state PENDING on host %s',
|
||||||
$object->stats->services_pending
|
'List %u services which are currently in state PENDING on host %s',
|
||||||
|
$object->stats->services_pending
|
||||||
|
),
|
||||||
|
$object->stats->services_pending,
|
||||||
|
$object->host_name
|
||||||
),
|
),
|
||||||
$object->stats->services_pending,
|
'data-base-target' => '_next'
|
||||||
$object->host_name
|
)
|
||||||
))
|
|
||||||
) ?>
|
) ?>
|
||||||
</span>
|
</span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<div class="controls">
|
|
||||||
<?php if (! $this->compact): ?>
|
|
||||||
<?= $this->tabs; ?>
|
|
||||||
<?php endif ?>
|
|
||||||
<?= $this->render('partials/host/object-header.phtml') ?>
|
|
||||||
<?= $this->render('partials/host/servicesummary.phtml') ?>
|
|
||||||
</div>
|
|
||||||
<?= $services ?>
|
|
|
@ -181,19 +181,6 @@ abstract class MonitoredObjectController extends Controller
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$tabs->add(
|
|
||||||
'services',
|
|
||||||
array(
|
|
||||||
'title' => sprintf(
|
|
||||||
$this->translate('List all services on host %s'),
|
|
||||||
$isService ? $object->getHost()->getName() : $object->getName()
|
|
||||||
),
|
|
||||||
'label' => $this->translate('Services'),
|
|
||||||
'icon' => 'services',
|
|
||||||
'url' => 'monitoring/show/services',
|
|
||||||
'urlParams' => $params
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($this->backend->hasQuery('eventHistory')) {
|
if ($this->backend->hasQuery('eventHistory')) {
|
||||||
$tabs->add(
|
$tabs->add(
|
||||||
'history',
|
'history',
|
||||||
|
|
Loading…
Reference in New Issue