From 18db984057b83ca4962c89b6b79bdce6a660b58f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:42:35 +0200 Subject: Adding upstream version 2.4.0. Signed-off-by: Daniel Baumann --- library/Businessprocess/HostNode.php | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 library/Businessprocess/HostNode.php (limited to 'library/Businessprocess/HostNode.php') diff --git a/library/Businessprocess/HostNode.php b/library/Businessprocess/HostNode.php new file mode 100644 index 0000000..b66f66f --- /dev/null +++ b/library/Businessprocess/HostNode.php @@ -0,0 +1,64 @@ + self::ICINGA_DOWN, + 3 => self::ICINGA_UNREACHABLE, + 1 => self::ICINGA_PENDING, + 0 => self::ICINGA_UP + ); + + protected $stateToSortStateMap = array( + self::ICINGA_PENDING => 1, + self::ICINGA_UNREACHABLE => 3, + self::ICINGA_DOWN => 4, + self::ICINGA_UP => 0, + ); + + protected $stateNames = array( + 'UP', + 'DOWN', + 'UNREACHABLE', + 99 => 'PENDING' + ); + + protected $hostname; + + protected $className = 'host'; + + protected $icon = 'host'; + + public function __construct($object) + { + $this->name = $object->hostname . ';Hoststatus'; + $this->hostname = $object->hostname; + if (isset($object->state)) { + $this->setState($object->state); + } else { + $this->setState(0)->setMissing(); + } + } + + public function getHostname() + { + return $this->hostname; + } + + public function getUrl() + { + $params = array( + 'host' => $this->getHostname(), + ); + + if ($this->getBpConfig()->hasBackendName()) { + $params['backend'] = $this->getBpConfig()->getBackendName(); + } + + return Url::fromPath('businessprocess/host/show', $params); + } +} -- cgit v1.2.3