Object\Host: not-so-nice workaround, LS contancts
This commit is contained in:
parent
5bb3165da3
commit
a8a7da4ade
modules/monitoring/library/Monitoring/Object
|
@ -89,7 +89,7 @@ class Host extends MonitoredObject
|
|||
*/
|
||||
protected function getDataView()
|
||||
{
|
||||
return $this->backend->select()->from('hostStatus', array(
|
||||
$columns = array(
|
||||
'host_name',
|
||||
'host_alias',
|
||||
'host_address',
|
||||
|
@ -132,7 +132,11 @@ class Host extends MonitoredObject
|
|||
'host_problem',
|
||||
'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);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,21 @@ abstract class MonitoredObject
|
|||
public function fetch()
|
||||
{
|
||||
$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…
Reference in New Issue