mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
Merge pull request #3846 from Icinga/feature/contact-and-contactgroup-filter
Add contact and contactgroup filters
This commit is contained in:
commit
a33fda9dd7
@ -26,6 +26,12 @@ class HostgroupQuery extends IdoQuery
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $columnMap = array(
|
protected $columnMap = array(
|
||||||
|
'contacts' => [
|
||||||
|
'host_contact' => 'hco.name1'
|
||||||
|
],
|
||||||
|
'contactgroups' => [
|
||||||
|
'host_contactgroup' => 'hcgo.name1'
|
||||||
|
],
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||||
@ -125,6 +131,42 @@ class HostgroupQuery extends IdoQuery
|
|||||||
$this->joinedVirtualTables['hostgroups'] = true;
|
$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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinContactgroups()
|
||||||
|
{
|
||||||
|
$this->requireVirtualTable('hosts');
|
||||||
|
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['hcg' => 'icinga_host_contactgroups'],
|
||||||
|
'hcg.host_id = h.host_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['hcgo' => 'icinga_objects'],
|
||||||
|
'hcgo.object_id = hcg.contactgroup_object_id AND hcgo.is_active = 1 AND hcgo.objecttype_id = 11',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join hosts
|
* Join hosts
|
||||||
*/
|
*/
|
||||||
|
@ -32,6 +32,12 @@ class HoststatusQuery extends IdoQuery
|
|||||||
'checktimeperiods' => array(
|
'checktimeperiods' => array(
|
||||||
'host_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
'host_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
||||||
),
|
),
|
||||||
|
'contacts' => [
|
||||||
|
'host_contact' => 'hco.name1'
|
||||||
|
],
|
||||||
|
'contactgroups' => [
|
||||||
|
'host_contactgroup' => 'hcgo.name1'
|
||||||
|
],
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||||
@ -201,6 +207,38 @@ 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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinContactgroups()
|
||||||
|
{
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['hcg' => 'icinga_host_contactgroups'],
|
||||||
|
'hcg.host_id = h.host_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['hcgo' => 'icinga_objects'],
|
||||||
|
'hcgo.object_id = hcg.contactgroup_object_id AND hcgo.is_active = 1 AND hcgo.objecttype_id = 11',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join host groups
|
* Join host groups
|
||||||
*/
|
*/
|
||||||
|
@ -22,6 +22,18 @@ class ServicegroupQuery extends IdoQuery
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $columnMap = array(
|
protected $columnMap = array(
|
||||||
|
'contacts' => [
|
||||||
|
'service_contact' => 'sco.name1'
|
||||||
|
],
|
||||||
|
'contactgroups' => [
|
||||||
|
'service_contactgroup' => 'scgo.name1'
|
||||||
|
],
|
||||||
|
'hostcontacts' => [
|
||||||
|
'host_contact' => 'hco.name1'
|
||||||
|
],
|
||||||
|
'hostcontactgroups' => [
|
||||||
|
'host_contactgroup' => 'hcgo.name1'
|
||||||
|
],
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup_name' => 'hgo.name1'
|
'hostgroup_name' => 'hgo.name1'
|
||||||
),
|
),
|
||||||
@ -96,6 +108,86 @@ class ServicegroupQuery extends IdoQuery
|
|||||||
$this->joinedVirtualTables = array('servicegroups' => true);
|
$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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinContactgroups()
|
||||||
|
{
|
||||||
|
$this->requireVirtualTable('services');
|
||||||
|
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['scg' => 'icinga_service_contactgroups'],
|
||||||
|
'scg.service_id = s.service_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['scgo' => 'icinga_objects'],
|
||||||
|
'scgo.object_id = scg.contactgroup_object_id AND scgo.is_active = 1 AND scgo.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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinHostcontactgroups()
|
||||||
|
{
|
||||||
|
$this->requireVirtualTable('services');
|
||||||
|
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['h' => 'icinga_hosts'],
|
||||||
|
'h.host_object_id = s.host_object_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['hcg' => 'icinga_host_contactgroups'],
|
||||||
|
'hcg.host_id = h.host_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['hcgo' => 'icinga_objects'],
|
||||||
|
'hcgo.object_id = hcg.contactgroup_object_id AND hcgo.is_active = 1 AND hcgo.objecttype_id = 11',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join host groups
|
* Join host groups
|
||||||
*/
|
*/
|
||||||
@ -125,6 +217,9 @@ class ServicegroupQuery extends IdoQuery
|
|||||||
protected function joinHosts()
|
protected function joinHosts()
|
||||||
{
|
{
|
||||||
$this->requireVirtualTable('services');
|
$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 `joinHostcontact*()` where we explicitly do this already
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,18 @@ class ServicestatusQuery extends IdoQuery
|
|||||||
'checktimeperiods' => array(
|
'checktimeperiods' => array(
|
||||||
'service_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
'service_check_timeperiod' => 'ctp.alias COLLATE latin1_general_ci'
|
||||||
),
|
),
|
||||||
|
'contacts' => [
|
||||||
|
'service_contact' => 'sco.name1'
|
||||||
|
],
|
||||||
|
'contactgroups' => [
|
||||||
|
'service_contactgroup' => 'scgo.name1'
|
||||||
|
],
|
||||||
|
'hostcontacts' => [
|
||||||
|
'host_contact' => 'hco.name1'
|
||||||
|
],
|
||||||
|
'hostcontactgroups' => [
|
||||||
|
'host_contactgroup' => 'hcgo.name1'
|
||||||
|
],
|
||||||
'hostgroups' => array(
|
'hostgroups' => array(
|
||||||
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
|
||||||
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
|
||||||
@ -310,6 +322,74 @@ 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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinContactgroups()
|
||||||
|
{
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['scg' => 'icinga_service_contactgroups'],
|
||||||
|
'scg.service_id = s.service_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['scgo' => 'icinga_objects'],
|
||||||
|
'scgo.object_id = scg.contactgroup_object_id AND scgo.is_active = 1 AND scgo.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 contact groups
|
||||||
|
*/
|
||||||
|
protected function joinHostcontactgroups()
|
||||||
|
{
|
||||||
|
$this->requireVirtualTable('hosts');
|
||||||
|
|
||||||
|
$this->select->joinLeft(
|
||||||
|
['hcg' => 'icinga_host_contactgroups'],
|
||||||
|
'hcg.host_id = h.host_id',
|
||||||
|
[]
|
||||||
|
)->joinLeft(
|
||||||
|
['hcgo' => 'icinga_objects'],
|
||||||
|
'hcgo.object_id = hcg.contactgroup_object_id AND hcgo.is_active = 1 AND hcgo.objecttype_id = 11',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join host groups
|
* Join host groups
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@ class Hostgroupsummary extends DataView
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'instance_name',
|
'instance_name',
|
||||||
'host', 'host_alias', 'host_display_name', 'host_name',
|
'host', 'host_alias', 'host_contact', 'host_contactgroup', 'host_display_name', 'host_name',
|
||||||
'hostgroup',
|
'hostgroup',
|
||||||
'service', 'service_description', 'service_display_name',
|
'service', 'service_description', 'service_display_name',
|
||||||
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
||||||
|
@ -71,7 +71,7 @@ class HostStatus extends DataView
|
|||||||
public function getStaticFilterColumns()
|
public function getStaticFilterColumns()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'host',
|
'host', 'host_contact', 'host_contactgroup',
|
||||||
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
||||||
'service', 'service_description', 'service_display_name',
|
'service', 'service_description', 'service_display_name',
|
||||||
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
||||||
|
@ -52,9 +52,9 @@ class Servicegroupsummary extends DataView
|
|||||||
return array(
|
return array(
|
||||||
'instance_name',
|
'instance_name',
|
||||||
'services_severity',
|
'services_severity',
|
||||||
'host', 'host_alias', 'host_display_name', 'host_name',
|
'host', 'host_alias', 'host_contact', 'host_contactgroup', 'host_display_name', 'host_name',
|
||||||
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
||||||
'service', 'service_description', 'service_display_name',
|
'service', 'service_contact', 'service_contactgroup', 'service_description', 'service_display_name',
|
||||||
'servicegroup'
|
'servicegroup'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -155,10 +155,14 @@ class ServiceStatus extends DataView
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'host',
|
'host',
|
||||||
|
'host_contact',
|
||||||
|
'host_contactgroup',
|
||||||
'hostgroup',
|
'hostgroup',
|
||||||
'hostgroup_alias',
|
'hostgroup_alias',
|
||||||
'hostgroup_name',
|
'hostgroup_name',
|
||||||
'service',
|
'service',
|
||||||
|
'service_contact',
|
||||||
|
'service_contactgroup',
|
||||||
'service_host',
|
'service_host',
|
||||||
'servicegroup',
|
'servicegroup',
|
||||||
'servicegroup_alias',
|
'servicegroup_alias',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user