mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
monitoring: Allow the hoststatus query to be filtered by restrictable columns
refs #9009
This commit is contained in:
parent
c17334deee
commit
b1446fcb23
@ -144,8 +144,18 @@ class HoststatusQuery extends IdoQuery
|
|||||||
'host_status_update_time' => 'hs.status_update_time',
|
'host_status_update_time' => 'hs.status_update_time',
|
||||||
'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END'
|
'host_unhandled' => 'CASE WHEN (hs.problem_has_been_acknowledged + hs.scheduled_downtime_depth) = 0 THEN 1 ELSE 0 END'
|
||||||
),
|
),
|
||||||
|
'servicegroups' => array(
|
||||||
|
'servicegroup' => 'sgo.name1 COLLATE latin1_general_ci',
|
||||||
|
'servicegroup_name' => 'sgo.name1',
|
||||||
|
'servicegroup_alias' => 'sg.alias COLLATE latin1_general_ci'
|
||||||
|
),
|
||||||
'serviceproblemsummary' => array(
|
'serviceproblemsummary' => array(
|
||||||
'host_unhandled_services' => 'sps.unhandled_services_count'
|
'host_unhandled_services' => 'sps.unhandled_services_count'
|
||||||
|
),
|
||||||
|
'services' => array(
|
||||||
|
'service' => 'so.name2 COLLATE latin1_general_ci',
|
||||||
|
'service_description' => 'so.name2',
|
||||||
|
'service_display_name' => 's.display_name COLLATE latin1_general_ci',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -204,10 +214,10 @@ class HoststatusQuery extends IdoQuery
|
|||||||
'hgo.is_active = ?',
|
'hgo.is_active = ?',
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
->where(
|
->where(
|
||||||
'hgo.objecttype_id = ?',
|
'hgo.objecttype_id = ?',
|
||||||
3
|
3
|
||||||
);
|
);
|
||||||
$this->distinct();
|
$this->distinct();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,6 +233,59 @@ class HoststatusQuery extends IdoQuery
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join service groups
|
||||||
|
*/
|
||||||
|
protected function joinServicegroups()
|
||||||
|
{
|
||||||
|
$this->requireVirtualTable('services');
|
||||||
|
$this->select->join(
|
||||||
|
array('sgm' => $this->prefix . 'servicegroup_members'),
|
||||||
|
'sgm.service_object_id = s.service_object_id',
|
||||||
|
array()
|
||||||
|
)->join(
|
||||||
|
array('sg' => $this->prefix . 'servicegroups'),
|
||||||
|
'sgm.servicegroup_id = sg.' . $this->servicegroup_id,
|
||||||
|
array()
|
||||||
|
)->join(
|
||||||
|
array('sgo' => $this->prefix . 'objects'),
|
||||||
|
'sgo.object_id = sg.servicegroup_object_id',
|
||||||
|
array()
|
||||||
|
)->where(
|
||||||
|
'sgo.is_active = ?',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
->where(
|
||||||
|
'sgo.objecttype_id = ?',
|
||||||
|
4
|
||||||
|
);
|
||||||
|
$this->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join services
|
||||||
|
*/
|
||||||
|
protected function joinServices()
|
||||||
|
{
|
||||||
|
$this->select->join(
|
||||||
|
array('s' => $this->prefix . 'services'),
|
||||||
|
's.host_object_id = h.host_object_id',
|
||||||
|
array()
|
||||||
|
)->join(
|
||||||
|
array('so' => $this->prefix . 'objects'),
|
||||||
|
'so.object_id = s.service_object_id AND so.is_active = 1',
|
||||||
|
array()
|
||||||
|
)->where(
|
||||||
|
'so.is_active = ?',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
->where(
|
||||||
|
'so.objecttype_id = ?',
|
||||||
|
2
|
||||||
|
);
|
||||||
|
$this->distinct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join service problem summary
|
* Join service problem summary
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user