mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-16 09:20:53 -05:00
BpNode: Use worst state in minimum state calculation
Ensure we use the worst state within a minimum condition, previously we did use the Xth best. refs #167
This commit is contained in:
parent
e5f7e30472
commit
9120449acb
1 changed files with 15 additions and 5 deletions
|
|
@ -364,13 +364,23 @@ class BpNode extends Node
|
|||
break;
|
||||
default:
|
||||
// MIN:
|
||||
sort($sort_states);
|
||||
|
||||
// default -> unknown
|
||||
$sort_state = 3 << self::SHIFT_FLAGS;
|
||||
|
||||
for ($i = 1; $i <= $this->operator; $i++) {
|
||||
$sort_state = array_shift($sort_states);
|
||||
if (count($sort_states) >= $this->operator) {
|
||||
$actualGood = 0;
|
||||
foreach ($sort_states as $s) {
|
||||
if (($s >> self::SHIFT_FLAGS) === self::ICINGA_OK) {
|
||||
$actualGood++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($actualGood >= $this->operator) {
|
||||
// condition is fulfilled
|
||||
$sort_state = self::ICINGA_OK;
|
||||
} else {
|
||||
// worst state if not fulfilled
|
||||
$sort_state = max($sort_states);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($sort_state & self::FLAG_DOWNTIME) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue