Host Overview: Use a dedicated query to fetch service summaries

refs #9864
This commit is contained in:
Johannes Meyer 2015-08-07 15:37:35 +02:00
parent 03d4386763
commit a4fdb30067
2 changed files with 20 additions and 5 deletions

View File

@ -120,6 +120,21 @@ class Monitoring_ListController extends Controller
'host_address' => $this->translate('Address'),
'host_last_check' => $this->translate('Last Check')
), $query);
$summary = $this->backend->select()->from('Hostservicestatussummary', array(
'host_name',
'unhandled_service_count'
));
$summary->addFilter($query->getFilter());
$this->setupSortControl(array(
'host_severity' => $this->translate('Severity'),
'host_state' => $this->translate('Current State'),
'host_display_name' => $this->translate('Hostname'),
'host_address' => $this->translate('Address'),
'host_last_check' => $this->translate('Last Check')
), $summary);
$summary->limit($query->getLimit(), $query->getOffset());
$this->view->summary = $summary->fetchPairs();
}
/**

View File

@ -58,11 +58,11 @@ if (! $this->compact): ?>
'class' => 'rowaction'
)
); ?>
<?php if (isset($host->host_unhandled_services) && $host->host_unhandled_services > 0): ?>
<?php if (isset($summary[$host->host_name])): ?>
<span> (<?= $this->qlink(
sprintf(
$this->translatePlural('%u unhandled service', '%u unhandled services', $host->host_unhandled_services),
$host->host_unhandled_services
$this->translatePlural('%u unhandled service', '%u unhandled services', $summary[$host->host_name]),
$summary[$host->host_name]
),
'monitoring/list/services',
array(
@ -76,9 +76,9 @@ if (! $this->compact): ?>
$this->translatePlural(
'List %s unhandled service problem on host %s',
'List %s unhandled service problems on host %s',
$host->host_unhandled_services
$summary[$host->host_name]
),
$host->host_unhandled_services,
$summary[$host->host_name],
$host->host_name
)
)