monitoring: Remove ServicecommenthistoryQuery::getGroup()

refs #9956
This commit is contained in:
Eric Lippmann 2015-09-29 22:36:02 +02:00
parent a3b74fe6d0
commit e8ce410f08
1 changed files with 16 additions and 26 deletions

View File

@ -13,6 +13,16 @@ class ServicecommenthistoryQuery extends IdoQuery
*/
protected $allowCustomVars = true;
/**
* {@inheritdoc}
*/
protected $groupBase = array('commenthistory' => array('sch.commenthistory_id', 'so.object_id'));
/**
* {@inheritdoc}
*/
protected $groupOrigin = array('hostgroups', 'services');
/**
* {@inheritdoc}
*/
@ -23,18 +33,16 @@ class ServicecommenthistoryQuery extends IdoQuery
'commenthistory' => array(
'host' => 'so.name1 COLLATE latin1_general_ci',
'host_name' => 'so.name1',
'object_id' => 'sch.object_id',
'object_type' => '(\'service\')',
'output' => "('[' || sch.author_name || '] ' || sch.comment_data)",
'service' => 'so.name2 COLLATE latin1_general_ci',
'service_description' => 'so.name2',
'service_host' => 'so.name1 COLLATE latin1_general_ci',
'service_host_name' => 'so.name1'
),
'history' => array(
'type' => "(CASE sch.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)",
'timestamp' => 'UNIX_TIMESTAMP(sch.comment_time)',
'object_id' => 'sch.object_id',
'state' => '(-1)',
'output' => "('[' || sch.author_name || '] ' || sch.comment_data)",
'service_host_name' => 'so.name1',
'state' => '(-1)',
'timestamp' => 'UNIX_TIMESTAMP(sch.comment_time)',
'type' => "(CASE sch.entry_type WHEN 1 THEN 'comment' WHEN 2 THEN 'dt_comment' WHEN 3 THEN 'flapping' WHEN 4 THEN 'ack' END)"
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
@ -81,7 +89,6 @@ class ServicecommenthistoryQuery extends IdoQuery
array()
);
$this->joinedVirtualTables['commenthistory'] = true;
$this->joinedVirtualTables['history'] = true;
}
/**
@ -161,21 +168,4 @@ class ServicecommenthistoryQuery extends IdoQuery
array()
);
}
/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('servicegroups')) {
$group = array('sch.commenthistory_id', 'so.object_id');
if ($this->hasJoinedVirtualTable('services')) {
$group[] = 'h.host_id';
$group[] = 's.service_id';
}
}
return $group;
}
}