HoststatusQuery: PostgreSQL grouping...

refs #9009
This commit is contained in:
Johannes Meyer 2015-06-18 11:52:58 +02:00
parent b9479e7da4
commit 37103cf72d
1 changed files with 36 additions and 3 deletions

View File

@ -230,7 +230,6 @@ SQL;
'hgo.object_id = hg.hostgroup_object_id AND hgo.is_active = 1 AND hgo.objecttype_id = 3',
array()
);
$this->group('ho.name1');
}
/**
@ -312,7 +311,6 @@ SQL;
'sgo.object_id = sg.servicegroup_object_id AND sgo.is_active = 1 AND sgo.objecttype_id = 4',
array()
);
$this->group('ho.name1');
}
/**
@ -330,7 +328,6 @@ SQL;
'so.object_id = s.service_object_id AND so.is_active = 1 AND so.objecttype_id = 2',
array()
);
$this->group('ho.name1');
}
/**
@ -371,4 +368,40 @@ SQL;
array()
);
}
/**
* {@inheritdoc}
*/
public function getGroup()
{
$group = array();
if ($this->hasJoinedVirtualTable('hostgroups') || $this->hasJoinedVirtualTable('services')) {
$group = array('h.host_id', 'ho.object_id');
if ($this->hasJoinedVirtualTable('hoststatus')) {
$group[] = 'hs.hoststatus_id';
}
if ($this->hasJoinedVirtualTable('serviceproblemsummary')) {
$group[] = 'sps.unhandled_services_count';
}
if ($this->hasJoinedVirtualTable('lasthostackcomment')) {
$group[] = 'hlac.last_ack_data';
}
if ($this->hasJoinedVirtualTable('lasthostcomment')) {
$group[] = 'hlc.last_comment_data';
}
if ($this->hasJoinedVirtualTable('lasthostdowntimecomment')) {
$group[] = 'hldc.last_downtime_data';
}
if ($this->hasJoinedVirtualTable('lasthostflappingcomment')) {
$group[] = 'hlfc.last_flapping_data';
}
}
return $group;
}
}