Fetch the service problem summary of a host with less redundant code
refs #9864
This commit is contained in:
parent
78fdf85c7e
commit
00d143cb14
|
@ -121,19 +121,8 @@ class Monitoring_ListController extends Controller
|
|||
'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());
|
||||
$summary = $query->getQuery()->queryServiceProblemSummary();
|
||||
$this->applyRestriction('monitoring/filter/objects', $summary);
|
||||
$this->view->summary = $summary->fetchPairs();
|
||||
}
|
||||
|
||||
|
|
|
@ -449,4 +449,20 @@ SQL;
|
|||
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the service problem summary for all hosts of this query's result set
|
||||
*
|
||||
* @return HostserviceproblemsummaryQuery
|
||||
*/
|
||||
public function queryServiceProblemSummary()
|
||||
{
|
||||
return $this->createSubQuery('Hostserviceproblemsummary')
|
||||
->setHostStatusQuery($this)
|
||||
->columns(array(
|
||||
'host_name',
|
||||
'unhandled_service_count'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue