mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
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')
|
'host_last_check' => $this->translate('Last Check')
|
||||||
), $query);
|
), $query);
|
||||||
|
|
||||||
$summary = $this->backend->select()->from('Hostservicestatussummary', array(
|
$summary = $query->getQuery()->queryServiceProblemSummary();
|
||||||
'host_name',
|
$this->applyRestriction('monitoring/filter/objects', $summary);
|
||||||
'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();
|
$this->view->summary = $summary->fetchPairs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,4 +449,20 @@ SQL;
|
|||||||
|
|
||||||
return $group;
|
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…
x
Reference in New Issue
Block a user