Allow to filter for contacts
This commit is contained in:
parent
4dcea91775
commit
523a35f4c1
|
@ -26,6 +26,9 @@ class HostgroupQuery extends IdoQuery
|
|||
);
|
||||
|
||||
protected $columnMap = array(
|
||||
'contacts' => [
|
||||
'host_contact' => 'hco.name1'
|
||||
],
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||
|
@ -125,6 +128,24 @@ class HostgroupQuery extends IdoQuery
|
|||
$this->joinedVirtualTables['hostgroups'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join contacts
|
||||
*/
|
||||
protected function joinContacts()
|
||||
{
|
||||
$this->requireVirtualTable('hosts');
|
||||
|
||||
$this->select->joinLeft(
|
||||
['hc' => 'icinga_host_contacts'],
|
||||
'hc.host_id = h.host_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hco' => 'icinga_objects'],
|
||||
'hco.object_id = hc.contact_object_id AND hco.is_active = 1 AND hco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join hosts
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,9 @@ class HoststatusQuery extends IdoQuery
|
|||
'checktimeperiods' => array(
|
||||
'host_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
||||
),
|
||||
'contacts' => [
|
||||
'host_contact' => 'hco.name1'
|
||||
],
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||
|
@ -201,6 +204,22 @@ class HoststatusQuery extends IdoQuery
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join contacts
|
||||
*/
|
||||
protected function joinContacts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
['hc' => 'icinga_host_contacts'],
|
||||
'hc.host_id = h.host_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hco' => 'icinga_objects'],
|
||||
'hco.object_id = hc.contact_object_id AND hco.is_active = 1 AND hco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join host groups
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,12 @@ class ServicegroupQuery extends IdoQuery
|
|||
);
|
||||
|
||||
protected $columnMap = array(
|
||||
'contacts' => [
|
||||
'service_contact' => 'sco.name1'
|
||||
],
|
||||
'hostcontacts' => [
|
||||
'host_contact' => 'hco.name1'
|
||||
],
|
||||
'hostgroups' => array(
|
||||
'hostgroup_name' => 'hgo.name1'
|
||||
),
|
||||
|
@ -96,6 +102,46 @@ class ServicegroupQuery extends IdoQuery
|
|||
$this->joinedVirtualTables = array('servicegroups' => true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join contacts
|
||||
*/
|
||||
protected function joinContacts()
|
||||
{
|
||||
$this->requireVirtualTable('services');
|
||||
|
||||
$this->select->joinLeft(
|
||||
['sc' => 'icinga_service_contacts'],
|
||||
'sc.service_id = s.service_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['sco' => 'icinga_objects'],
|
||||
'sco.object_id = sc.contact_object_id AND sco.is_active = 1 AND sco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join host contacts
|
||||
*/
|
||||
protected function joinHostcontacts()
|
||||
{
|
||||
$this->requireVirtualTable('services');
|
||||
|
||||
$this->select->joinLeft(
|
||||
['h' => 'icinga_hosts'],
|
||||
'h.host_object_id = s.host_object_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hc' => 'icinga_host_contacts'],
|
||||
'hc.host_id = h.host_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hco' => 'icinga_objects'],
|
||||
'hco.object_id = hc.contact_object_id AND hco.is_active = 1 AND hco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join host groups
|
||||
*/
|
||||
|
@ -125,6 +171,9 @@ class ServicegroupQuery extends IdoQuery
|
|||
protected function joinHosts()
|
||||
{
|
||||
$this->requireVirtualTable('services');
|
||||
|
||||
// Host custom var filters work w/o any host related table. If a host table join is necessary here some day,
|
||||
// please adjust `joinHostcontacts()` where we explicitly do this already
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,12 @@ class ServicestatusQuery extends IdoQuery
|
|||
'checktimeperiods' => array(
|
||||
'service_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
||||
),
|
||||
'contacts' => [
|
||||
'service_contact' => 'sco.name1'
|
||||
],
|
||||
'hostcontacts' => [
|
||||
'host_contact' => 'hco.name1'
|
||||
],
|
||||
'hostgroups' => array(
|
||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||
|
@ -310,6 +316,40 @@ class ServicestatusQuery extends IdoQuery
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join contacts
|
||||
*/
|
||||
protected function joinContacts()
|
||||
{
|
||||
$this->select->joinLeft(
|
||||
['sc' => 'icinga_service_contacts'],
|
||||
'sc.service_id = s.service_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['sco' => 'icinga_objects'],
|
||||
'sco.object_id = sc.contact_object_id AND sco.is_active = 1 AND sco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join host contacts
|
||||
*/
|
||||
protected function joinHostcontacts()
|
||||
{
|
||||
$this->requireVirtualTable('hosts');
|
||||
|
||||
$this->select->joinLeft(
|
||||
['hc' => 'icinga_host_contacts'],
|
||||
'hc.host_id = h.host_id',
|
||||
[]
|
||||
)->joinLeft(
|
||||
['hco' => 'icinga_objects'],
|
||||
'hco.object_id = hc.contact_object_id AND hco.is_active = 1 AND hco.objecttype_id = 10',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Join host groups
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ class Hostgroupsummary extends DataView
|
|||
{
|
||||
return array(
|
||||
'instance_name',
|
||||
'host', 'host_alias', 'host_display_name', 'host_name',
|
||||
'host', 'host_alias', 'host_contact', 'host_display_name', 'host_name',
|
||||
'hostgroup',
|
||||
'service', 'service_description', 'service_display_name',
|
||||
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
||||
|
|
|
@ -71,7 +71,7 @@ class HostStatus extends DataView
|
|||
public function getStaticFilterColumns()
|
||||
{
|
||||
return array(
|
||||
'host',
|
||||
'host', 'host_contact',
|
||||
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
||||
'service', 'service_description', 'service_display_name',
|
||||
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
||||
|
|
|
@ -52,9 +52,9 @@ class Servicegroupsummary extends DataView
|
|||
return array(
|
||||
'instance_name',
|
||||
'services_severity',
|
||||
'host', 'host_alias', 'host_display_name', 'host_name',
|
||||
'host', 'host_alias', 'host_contact', 'host_display_name', 'host_name',
|
||||
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
||||
'service', 'service_description', 'service_display_name',
|
||||
'service', 'service_contact', 'service_description', 'service_display_name',
|
||||
'servicegroup'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -155,10 +155,12 @@ class ServiceStatus extends DataView
|
|||
{
|
||||
return array(
|
||||
'host',
|
||||
'host_contact',
|
||||
'hostgroup',
|
||||
'hostgroup_alias',
|
||||
'hostgroup_name',
|
||||
'service',
|
||||
'service_contact',
|
||||
'service_host',
|
||||
'servicegroup',
|
||||
'servicegroup_alias',
|
||||
|
|
Loading…
Reference in New Issue