Monitoring/Statusdat: Fix filter by handled/unhandled

refs #3801
This commit is contained in:
Eric Lippmann 2013-10-25 13:52:51 +02:00
parent a9086c5388
commit c9db103384

View File

@ -154,7 +154,7 @@ class StatusQuery extends StatusdatQuery
'service_severity' => 'getSeverity', 'service_severity' => 'getSeverity',
'service_in_downtime' => 'isInDowntime', 'service_in_downtime' => 'isInDowntime',
'service_problem' => 'isProblem', 'service_problem' => 'isProblem',
'service_attempt' => 'getAttemptString' 'service_attempt' => 'getAttemptString',
); );
public static $fieldTypes = array( public static $fieldTypes = array(
@ -190,12 +190,12 @@ class StatusQuery extends StatusdatQuery
public function isProblem(&$obj) public function isProblem(&$obj)
{ {
return $obj->status->current_state > 0; return $obj->status->current_state > 0 ? 1 : 0;
} }
public function isInDowntime(&$obj) public function isInDowntime(&$obj)
{ {
return $obj->status->scheduled_downtime_depth > 0; return $obj->status->scheduled_downtime_depth > 0 ? 1 : 0;
} }
public function getAddress(&$obj) public function getAddress(&$obj)
@ -255,14 +255,14 @@ class StatusQuery extends StatusdatQuery
public function isHandled(&$host) public function isHandled(&$host)
{ {
return $host->status->current_state == 0 || return ($host->status->current_state == 0 ||
$host->status->problem_has_been_acknowledged || $host->status->problem_has_been_acknowledged == 1 ||
$host->status->scheduled_downtime_depth; $host->status->scheduled_downtime_depth > 0) ? 1 : 0;
} }
public function isUnhandled(&$hostOrService) public function isUnhandled(&$hostOrService)
{ {
return !$this->isHandled($hostOrService); return +!$this->isHandled($hostOrService);
} }
public function getNrOfUnhandledServices(&$obj) public function getNrOfUnhandledServices(&$obj)