Merge branch 'feature/offer-instance-name-as-query-column-9943'

resolves #9943
This commit is contained in:
Johannes Meyer 2015-08-25 16:54:02 +02:00
commit bce7bc1277
40 changed files with 324 additions and 3 deletions

View File

@ -25,7 +25,8 @@ class CommentQuery extends IdoQuery
'comment_is_persistent' => 'c.comment_is_persistent',
'comment_timestamp' => 'c.comment_timestamp',
'comment_type' => 'c.comment_type',
'object_type' => 'c.object_type'
'object_type' => 'c.object_type',
'instance_name' => 'c.instance_name'
),
'hosts' => array(
'host_display_name' => 'c.host_display_name',

View File

@ -17,6 +17,9 @@ class ContactQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'contacts' => array(
'contact_id' => 'c.contact_id',
'contact' => 'co.name1 COLLATE latin1_general_ci',
@ -183,6 +186,18 @@ class ContactQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = c.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class ContactgroupQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'contactgroups' => array(
'contactgroup' => 'cgo.name1 COLLATE latin1_general_ci',
'contactgroup_name' => 'cgo.name1',
@ -187,6 +190,18 @@ class ContactgroupQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = cg.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -6,6 +6,9 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query;
class CustomvarQuery extends IdoQuery
{
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'customvariablestatus' => array(
'varname' => 'cvs.varname',
'varvalue' => 'cvs.varvalue',
@ -55,6 +58,18 @@ class CustomvarQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = cvs.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -30,7 +30,8 @@ class DowntimeQuery extends IdoQuery
'downtime_scheduled_end' => 'd.downtime_scheduled_end',
'downtime_scheduled_start' => 'd.downtime_scheduled_start',
'downtime_start' => 'd.downtime_start',
'object_type' => 'd.object_type'
'object_type' => 'd.object_type',
'instance_name' => 'd.instance_name'
),
'hosts' => array(
'host_display_name' => 'd.host_display_name',

View File

@ -17,6 +17,9 @@ class HostcommentQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'comments' => array(
'comment_author' => 'c.author_name COLLATE latin1_general_ci',
'comment_author_name' => 'c.author_name',
@ -151,6 +154,18 @@ class HostcommentQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = c.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class HostcommenthistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'commenthistory' => array(
'host' => 'ho.name1 COLLATE latin1_general_ci',
'host_name' => 'ho.name1',
@ -149,6 +152,18 @@ class HostcommenthistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hch.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class HostdowntimeQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimes' => array(
'downtime_author' => 'sd.author_name COLLATE latin1_general_ci',
'downtime_author_name' => 'sd.author_name',
@ -157,6 +160,18 @@ class HostdowntimeQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sd.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class HostdowntimestarthistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimehistory' => array(
'host' => 'ho.name1 COLLATE latin1_general_ci',
'host_name' => 'ho.name1',
@ -158,6 +161,18 @@ class HostdowntimestarthistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hdh.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class HostgroupQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
@ -126,6 +129,18 @@ class HostgroupQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hg.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class HostnotificationQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'notifications' => array(
'notification_output' => 'hn.output',
'notification_start_time' => 'UNIX_TIMESTAMP(hn.start_time)',
@ -224,6 +227,18 @@ class HostnotificationQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hn.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -21,6 +21,9 @@ class HostserviceproblemsummaryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'services' => array(
'host_name' => 'so.name1',
'service_description' => 'so.name2'
@ -76,6 +79,18 @@ class HostserviceproblemsummaryQuery extends IdoQuery
$this->joinedVirtualTables['services'] = true;
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = so.instance_id',
array()
);
}
/**
* Join host groups
*/

View File

@ -27,6 +27,9 @@ class HoststatehistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'statehistory' => array(
'host' => 'ho.name1 COLLATE latin1_general_ci',
'host_name' => 'ho.name1',
@ -165,6 +168,18 @@ class HoststatehistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = hh.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -16,6 +16,9 @@ class HoststatusQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
@ -237,6 +240,18 @@ class HoststatusQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = ho.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -26,7 +26,8 @@ class NotificationQuery extends IdoQuery
'acknowledgement_entry_time' => 'n.acknowledgement_entry_time',
'acknowledgement_author_name' => 'n.acknowledgement_author_name',
'acknowledgement_comment_data' => 'n.acknowledgement_comment_data',
'object_type' => 'n.object_type'
'object_type' => 'n.object_type',
'instance_name' => 'n.instance_name'
),
'history' => array(
'type' => 'n.type',

View File

@ -17,6 +17,9 @@ class ServicecommentQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'comments' => array(
'comment_author' => 'c.author_name COLLATE latin1_general_ci',
'comment_author_name' => 'c.author_name',
@ -165,6 +168,18 @@ class ServicecommentQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = c.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class ServicecommenthistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'commenthistory' => array(
'host' => 'so.name1 COLLATE latin1_general_ci',
'host_name' => 'so.name1',
@ -147,6 +150,18 @@ class ServicecommenthistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sch.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class ServicedowntimeQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimes' => array(
'downtime_author' => 'sd.author_name COLLATE latin1_general_ci',
'downtime_author_name' => 'sd.author_name',
@ -171,6 +174,18 @@ class ServicedowntimeQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sd.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class ServicedowntimestarthistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'downtimehistory' => array(
'host' => 'so.name1 COLLATE latin1_general_ci',
'host_name' => 'so.name1',
@ -156,6 +159,18 @@ class ServicedowntimestarthistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sdh.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -14,6 +14,9 @@ class ServicegroupQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
@ -118,6 +121,18 @@ class ServicegroupQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sg.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -17,6 +17,9 @@ class ServicenotificationQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'notifications' => array(
'notification_output' => 'sn.output',
'notification_start_time' => 'UNIX_TIMESTAMP(sn.start_time)',
@ -222,6 +225,18 @@ class ServicenotificationQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sn.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -27,6 +27,9 @@ class ServicestatehistoryQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'statehistory' => array(
'host' => 'so.name1 COLLATE latin1_general_ci',
'host_name' => 'so.name1',
@ -163,6 +166,18 @@ class ServicestatehistoryQuery extends IdoQuery
);
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = sh.instance_id',
array()
);
}
/**
* {@inheritdoc}
*/

View File

@ -19,6 +19,9 @@ class ServicestatusQuery extends IdoQuery
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_name' => 'i.instance_name'
),
'hostgroups' => array(
'hostgroup' => 'hgo.name1 COLLATE latin1_general_ci',
'hostgroup_alias' => 'hg.alias COLLATE latin1_general_ci',
@ -280,6 +283,18 @@ class ServicestatusQuery extends IdoQuery
$this->joinedVirtualTables['services'] = true;
}
/**
* Join instances
*/
protected function joinInstances()
{
$this->select->join(
array('i' => $this->prefix . 'instances'),
'i.instance_id = so.instance_id',
array()
);
}
/**
* Join host groups
*/

View File

@ -62,6 +62,7 @@ class Controller extends IcingaWebController
{
$restrictions = Filter::matchAny();
$restrictions->setAllowedFilterColumns(array(
'instance_name',
'host_name',
'hostgroup_name',
'service_description',
@ -85,6 +86,7 @@ class Controller extends IcingaWebController
$restriction,
$filter,
implode(', ', array(
'instance_name',
'host_name',
'hostgroup_name',
'service_description',

View File

@ -14,6 +14,7 @@ class Comment extends DataView
public function getColumns()
{
return array(
'instance_name',
'comment_author_name',
'comment_data',
'comment_expiration',

View File

@ -11,6 +11,7 @@ class Contact extends DataView
public function getColumns()
{
return array(
'instance_name',
'contact_object_id',
'contact_id',
'contact_name',

View File

@ -11,6 +11,7 @@ class Contactgroup extends DataView
public function getColumns()
{
return array(
'instance_name',
'contactgroup_name',
'contactgroup_alias',
'contact_object_id',

View File

@ -14,6 +14,7 @@ class Downtime extends DataView
public function getColumns()
{
return array(
'instance_name',
'downtime_author_name',
'downtime_comment',
'downtime_duration',

View File

@ -50,6 +50,7 @@ class Eventgrid extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'host', 'host_alias',
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
'service', 'service_host_name',

View File

@ -11,6 +11,7 @@ class EventHistory extends DataView
public function getColumns()
{
return array(
'instance_name',
'cnt_notification',
'cnt_hard_state',
'cnt_soft_state',

View File

@ -14,6 +14,7 @@ class Hostgroup extends DataView
public function getColumns()
{
return array(
'instance_name',
'hostgroup_alias',
'hostgroup_name'
);

View File

@ -47,6 +47,7 @@ class Hostgroupsummary extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'hosts_severity',
'host', 'host_alias', 'host_display_name', 'host_name',
'hostgroup',

View File

@ -11,6 +11,7 @@ class HostStatus extends DataView
public function getColumns()
{
return array(
'instance_name',
'host_name',
'host_display_name',
'host_alias',

View File

@ -30,6 +30,7 @@ class Hoststatussummary extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'host', 'host_alias', 'host_display_name', 'host_name',
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
'service', 'service_description', 'service_display_name',

View File

@ -11,6 +11,7 @@ class Notification extends DataView
public function getColumns()
{
return array(
'instance_name',
'notification_state',
'notification_start_time',
'notification_contact_name',

View File

@ -11,6 +11,7 @@ class Servicegroup extends DataView
public function getColumns()
{
return array(
'instance_name',
'servicegroup_alias',
'servicegroup_name'
);

View File

@ -42,6 +42,7 @@ class Servicegroupsummary extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'services_severity',
'host', 'host_alias', 'host_display_name', 'host_name',
'hostgroup', 'hostgroup_alias', 'hostgroup_name',

View File

@ -11,6 +11,7 @@ class ServiceStatus extends DataView
public function getColumns()
{
return array(
'instance_name',
'host_name',
'host_display_name',
'host_state',

View File

@ -35,6 +35,7 @@ class Servicestatussummary extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'host', 'host_alias', 'host_display_name', 'host_name',
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
'service', 'service_description', 'service_display_name',

View File

@ -101,6 +101,7 @@ class StatusSummary extends DataView
public function getStaticFilterColumns()
{
return array(
'instance_name',
'host', 'host_alias', 'host_display_name', 'host_name',
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
'service', 'service_description', 'service_display_name',