diff --git a/application/clicommands/ProcessCommand.php b/application/clicommands/ProcessCommand.php index 59c9d31..0baef23 100644 --- a/application/clicommands/ProcessCommand.php +++ b/application/clicommands/ProcessCommand.php @@ -9,6 +9,7 @@ use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\HostNode; use Icinga\Module\Businessprocess\Node; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\State\IcingaDbState; use Icinga\Module\Businessprocess\State\MonitoringState; use Icinga\Module\Businessprocess\Storage\LegacyStorage; @@ -133,7 +134,12 @@ class ProcessCommand extends Command /** @var BpNode $node */ try { $node = $bp->getNode($nodeName); - MonitoringState::apply($bp); + if ($bp->getBackendName() === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { + IcingaDbState::apply($bp); + } else { + MonitoringState::apply($bp); + } + if ($bp->hasErrors()) { Logger::error("Checking Business Process '%s' failed: %s\n", $name, $bp->getErrors()); diff --git a/application/controllers/NodeController.php b/application/controllers/NodeController.php index 4a4876a..ec5e699 100644 --- a/application/controllers/NodeController.php +++ b/application/controllers/NodeController.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Businessprocess\Controllers; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\Renderer\Breadcrumb; use Icinga\Module\Businessprocess\Renderer\TileRenderer; use Icinga\Module\Businessprocess\Simulation; @@ -82,7 +83,7 @@ class NodeController extends Controller if (empty($parents)) { continue; } - if ($config->getBackendName() === '_icingadb') { + if ($config->getBackendName() === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { IcingaDbState::apply($config); } else { MonitoringState::apply($config); diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 2b3eea7..6bf4417 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -6,6 +6,7 @@ use Icinga\Date\DateFormatter; use Icinga\Module\Businessprocess\BpConfig; use Icinga\Module\Businessprocess\BpNode; use Icinga\Module\Businessprocess\Node; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\Renderer\Breadcrumb; use Icinga\Module\Businessprocess\Renderer\Renderer; use Icinga\Module\Businessprocess\Renderer\TileRenderer; @@ -82,7 +83,7 @@ class ProcessController extends Controller $bp = $this->loadModifiedBpConfig(); $node = $this->getNode($bp); - if ($bp->getBackendName() === '_icingadb') { + if ($bp->getBackendName() === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { IcingaDbState::apply($bp); } else { MonitoringState::apply($bp); diff --git a/library/Businessprocess/Common/EnumList.php b/library/Businessprocess/Common/EnumList.php index 93d052b..508a662 100644 --- a/library/Businessprocess/Common/EnumList.php +++ b/library/Businessprocess/Common/EnumList.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Businessprocess\Common; use Icinga\Data\Filter\Filter; use Icinga\Module\Businessprocess\IcingaDbObject; use Icinga\Module\Businessprocess\MonitoringRestrictions; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; trait EnumList { @@ -133,6 +134,6 @@ trait EnumList protected function useIcingaDbBackend() { - return $this->backendName === '_icingadb'; + return $this->backendName === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend(); } } diff --git a/library/Businessprocess/HostNode.php b/library/Businessprocess/HostNode.php index cc5315e..f272f33 100644 --- a/library/Businessprocess/HostNode.php +++ b/library/Businessprocess/HostNode.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Businessprocess; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\Web\Url; use ipl\Html\Html; @@ -56,9 +57,9 @@ class HostNode extends MonitoredNode 'host' => $this->getHostname(), ); - if ($this->getBpConfig()->hasBackendName()) { + if ($this->getBpConfig()->hasBackendName() || IcingadbSupport::useIcingaDbAsBackend()) { $backendName = $this->getBpConfig()->getBackendName(); - if ($backendName === '_icingadb') { + if ($backendName === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { $params['icingadb'] = 1; } else { $params['backend'] = $this->getBpConfig()->getBackendName(); diff --git a/library/Businessprocess/ServiceNode.php b/library/Businessprocess/ServiceNode.php index ba9234a..6476281 100644 --- a/library/Businessprocess/ServiceNode.php +++ b/library/Businessprocess/ServiceNode.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Businessprocess; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\Web\Url; class ServiceNode extends MonitoredNode @@ -75,9 +76,10 @@ class ServiceNode extends MonitoredNode 'service' => $this->getServiceDescription() ); - if ($this->getBpConfig()->hasBackendName()) { + if ($this->getBpConfig()->hasBackendName() || IcingadbSupport::useIcingaDbAsBackend()) { $backendName = $this->getBpConfig()->getBackendName(); - if ($backendName === '_icingadb') { + + if ($backendName === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { $params['icingadb'] = 1; } else { $params['backend'] = $this->getBpConfig()->getBackendName(); diff --git a/library/Businessprocess/Web/Component/Dashboard.php b/library/Businessprocess/Web/Component/Dashboard.php index c57b48a..0f1acb0 100644 --- a/library/Businessprocess/Web/Component/Dashboard.php +++ b/library/Businessprocess/Web/Component/Dashboard.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Businessprocess\Web\Component; use Icinga\Authentication\Auth; +use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport; use Icinga\Module\Businessprocess\State\IcingaDbState; use Icinga\Module\Businessprocess\State\MonitoringState; use Icinga\Module\Businessprocess\Storage\Storage; @@ -92,7 +93,7 @@ class Dashboard extends BaseHtmlElement } $bp = $storage->loadProcess($name); - if ($bp->getBackendName() === '_icingadb') { + if ($bp->getBackendName() === '_icingadb' || IcingadbSupport::useIcingaDbAsBackend()) { IcingaDbState::apply($bp); } else { MonitoringState::apply($bp);