mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-25 00:59:34 -05:00
BusinessProcess: fix state type setting on fetch
This commit is contained in:
parent
dca6b1ae26
commit
91e9c7e321
1 changed files with 18 additions and 25 deletions
|
|
@ -51,33 +51,26 @@ class BusinessProcess
|
|||
$check_results = array();
|
||||
$hostFilter = array_keys($this->hosts);
|
||||
if ($this->state_type === self::HARD_STATE) {
|
||||
$db_states = $this->backend/*->module('Bpapp')*/
|
||||
->fetchHardStatesForBpHosts(array_keys($this->hosts));
|
||||
$hostStateColumn = 'host_hard_state';
|
||||
$serviceStateColumn = 'service_hard_state';
|
||||
} else {
|
||||
// TOM 2014
|
||||
// $db_states = $this->backend/*->module('Bpapp')*/
|
||||
// ->fetchSoftStatesForBpHosts(array_keys($this->hosts));
|
||||
$hostStatus = $backend->select()->from(
|
||||
'hostStatus',
|
||||
array(
|
||||
'hostname' => 'host_name',
|
||||
'in_downtime' => 'host_in_downtime',
|
||||
'ack' => 'host_acknowledged',
|
||||
'state' => 'host_state'
|
||||
)
|
||||
)->where('host_name', $hostFilter)->getQuery()->fetchAll();
|
||||
$serviceStatus = $backend->select()->from(
|
||||
'serviceStatus',
|
||||
array(
|
||||
'hostname' => 'host_name',
|
||||
'service' => 'service_description',
|
||||
'in_downtime' => 'service_in_downtime',
|
||||
'ack' => 'service_acknowledged',
|
||||
'state' => 'service_state'
|
||||
)
|
||||
)->where('host_name', $hostFilter)->getQuery()->fetchAll();
|
||||
|
||||
$hostStateColumn = 'host_state';
|
||||
$serviceStateColumn = 'service_state';
|
||||
}
|
||||
$hostStatus = $backend->select()->from('hostStatus', array(
|
||||
'hostname' => 'host_name',
|
||||
'in_downtime' => 'host_in_downtime',
|
||||
'ack' => 'host_acknowledged',
|
||||
'state' => $hostStateColumn
|
||||
))->where('host_name', $hostFilter)->getQuery()->fetchAll();
|
||||
|
||||
$serviceStatus = $backend->select()->from('serviceStatus', array(
|
||||
'hostname' => 'host_name',
|
||||
'service' => 'service_description',
|
||||
'in_downtime' => 'service_in_downtime',
|
||||
'ack' => 'service_acknowledged',
|
||||
'state' => $serviceStateColumn
|
||||
))->where('host_name', $hostFilter)->getQuery()->fetchAll();
|
||||
|
||||
foreach ($serviceStatus + $hostStatus as $row) {
|
||||
$key = $row->hostname;
|
||||
|
|
|
|||
Loading…
Reference in a new issue