count === null) { $count = 0; $state = Node::ICINGA_OK; try { $storage = LegacyStorage::getInstance(); foreach ($storage->listProcessNames() as $processName) { $bp = $storage->loadProcess($processName); if (Module::exists('icingadb') && (! $bp->hasBackendName() && IcingadbSupport::useIcingaDbAsBackend()) ) { IcingaDbState::apply($bp); } else { MonitoringState::apply($bp); } foreach ($bp->getRootNodes() as $rootNode) { $nodeState = $rootNode->getState(); if (! $rootNode->isEmpty() && ! in_array($nodeState, [Node::ICINGA_OK, Node::ICINGA_PENDING], true) ) { if ($nodeState === $state) { $count++; } elseif ($nodeState > $state) { $count = 1; $state = $nodeState; } break; } } } } catch (Throwable $e) { Logger::error('Failed to load business processes: %s', $e); } $this->count = $count; $this->setState(ProcessProblemsBadge::NODE_STATE_TO_BADGE_STATE[$state] ?? self::STATE_UNKNOWN); } return $this->count; } }