mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-21 04:44:25 +02:00
Object\Host: not-so-nice workaround, LS contancts
This commit is contained in:
parent
5bb3165da3
commit
a8a7da4ade
@ -89,7 +89,7 @@ class Host extends MonitoredObject
|
|||||||
*/
|
*/
|
||||||
protected function getDataView()
|
protected function getDataView()
|
||||||
{
|
{
|
||||||
return $this->backend->select()->from('hostStatus', array(
|
$columns = array(
|
||||||
'host_name',
|
'host_name',
|
||||||
'host_alias',
|
'host_alias',
|
||||||
'host_address',
|
'host_address',
|
||||||
@ -132,7 +132,11 @@ class Host extends MonitoredObject
|
|||||||
'host_problem',
|
'host_problem',
|
||||||
'host_process_performance_data',
|
'host_process_performance_data',
|
||||||
'process_perfdata' => 'host_process_performance_data'
|
'process_perfdata' => 'host_process_performance_data'
|
||||||
))
|
);
|
||||||
|
if ($this->backend->getType() === 'livestatus') {
|
||||||
|
$columns[] = 'host_contacts';
|
||||||
|
}
|
||||||
|
return $this->backend->select()->from('hostStatus', $columns)
|
||||||
->where('host_name', $this->host);
|
->where('host_name', $this->host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,21 @@ abstract class MonitoredObject
|
|||||||
public function fetch()
|
public function fetch()
|
||||||
{
|
{
|
||||||
$this->properties = $this->getDataView()->getQuery()->fetchRow();
|
$this->properties = $this->getDataView()->getQuery()->fetchRow();
|
||||||
return $this->properties !== false;
|
if ($this->properties === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isset($this->properties->host_contacts)) {
|
||||||
|
$this->contacts = array();
|
||||||
|
foreach (preg_split('~,~', $this->properties->host_contacts) as $contact) {
|
||||||
|
$this->contacts[] = (object) array(
|
||||||
|
'contact_name' => $contact,
|
||||||
|
'contact_alias' => $contact,
|
||||||
|
'contact_email' => null,
|
||||||
|
'contact_pager' => null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user