getModuleManager()->hasEnabled('idoreports')) { $name .= ' (Icinga DB)'; } return $name; } protected function createReportData() { return (new ReportData()) ->setDimensions([t('Hostname'), t('Service Name')]) ->setValues([t('SLA in %')]); } protected function createReportRow($row) { if ($row->sla === null) { return null; } return (new ReportRow()) ->setDimensions([$row->host->display_name, $row->display_name]) ->setValues([(float) $row->sla]); } protected function fetchSla(Timerange $timerange, Rule $filter = null) { $sla = Service::on($this->getDb()) ->columns([ 'host.display_name', 'display_name', 'sla' => new Expression(sprintf( "get_sla_ok_percent(%s, %s, '%s', '%s')", 'service.host_id', 'service.id', $timerange->getStart()->format('Uv'), $timerange->getEnd()->format('Uv') )) ]); $sla->resetOrderBy()->orderBy('host.display_name')->orderBy('display_name'); $this->applyRestrictions($sla); if ($filter !== null) { $sla->filter($filter); } return $sla; } }