monitoring: Rearrange code in the ServicestatusQuery

refs #9956
This commit is contained in:
Eric Lippmann 2015-09-29 22:47:07 +02:00
parent 6307af9e10
commit 844f80d2df
1 changed files with 15 additions and 12 deletions

View File

@ -27,6 +27,9 @@ class ServicestatusQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'checktimeperiods' => array(
'service_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
@ -277,9 +280,6 @@ class ServicestatusQuery extends IdoQuery
'service_state_type' => 'ss.state_type',
'service_status_update_time' => 'ss.status_update_time',
'service_unhandled' => 'CASE WHEN (ss.problem_has_been_acknowledged + ss.scheduled_downtime_depth + COALESCE(hs.current_state, 0)) = 0 THEN 1 ELSE 0 END'
),
'checktimeperiods' => array(
'service_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
)
);
@ -308,6 +308,18 @@ class ServicestatusQuery extends IdoQuery
$this->joinedVirtualTables['services'] = true;
}
/**
* Join check time periods
*/
protected function joinChecktimeperiods()
{
$this->select->joinLeft(
array('ctp' => $this->prefix . 'timeperiods'),
'ctp.timeperiod_object_id = s.check_timeperiod_object_id',
array()
);
}
/**
* Join host groups
*/
@ -397,15 +409,6 @@ class ServicestatusQuery extends IdoQuery
);
}
protected function joinChecktimeperiods()
{
$this->select->joinLeft(
array('ctp' => $this->prefix . 'timeperiods'),
'ctp.timeperiod_object_id = s.check_timeperiod_object_id',
array()
);
}
/**
* {@inheritdoc}
*/