From 98bd02c1643f0200b545cda6cd74df122d8db801 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 20 Feb 2017 15:00:15 +0100 Subject: [PATCH] Node: clear missing when setting state --- library/Businessprocess/BpNode.php | 8 +++++++- library/Businessprocess/Node.php | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/library/Businessprocess/BpNode.php b/library/Businessprocess/BpNode.php index 32a88a0..ef13384 100644 --- a/library/Businessprocess/BpNode.php +++ b/library/Businessprocess/BpNode.php @@ -334,7 +334,13 @@ class BpNode extends Node foreach ($this->getChildren() as $child) { $bp->beginLoopDetection($this->name); if ($child instanceof MonitoredNode && $child->isMissing()) { - $child->setState(self::ICINGA_UNKNOWN); + if ($child instanceof HostNode) { + $child->setState(self::ICINGA_UNREACHABLE); + } else { + $child->setState(self::ICINGA_UNKNOWN); + } + + $child->setMissing(); } $sort_states[] = $child->getSortingState(); $lastStateChange = max($lastStateChange, $child->getLastStateChange()); diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index b46046d..7396eb9 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -143,6 +143,7 @@ abstract class Node public function setState($state) { $this->state = (int) $state; + $this->missing = false; return $this; }