From d34da32f28c3b6bc3fe25cec56dc3ccb4ae19f84 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 21 Jul 2022 15:58:26 +0200 Subject: [PATCH] Make sure to expect ITL compatible custom var names --- doc/10-Monitoring.md | 14 +++++++------- .../Icingadb/ServiceDetailExtension.php | 8 ++++---- .../Monitoring/DetailviewExtension.php | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/10-Monitoring.md b/doc/10-Monitoring.md index b12a366..2d7c70c 100644 --- a/doc/10-Monitoring.md +++ b/doc/10-Monitoring.md @@ -39,11 +39,11 @@ configuration: checkcommand_name=businessprocess-check ``` -A service can define specific custom variables for this. Some are mandatory. -If they are not defined, the detail view integration won't be active. +A service can define specific custom variables for this. Mandatory ones +that are not defined, cause the detail view integration to not be active. -| Variable Name | Mandatory | Description | -|---------------------------|-----------|----------------------------------------------| -| businessprocess\_process | Yes | The `` being checked | -| businessprocess\_config | Yes | Name of the config that contains `` | -| businessprocess\_as\_tree | No | Whether to show `` as tree or tiles | +| Variable Name | Mandatory | Description | +|--------------------------------------|-----------|----------------------------------------------| +| icingacli\_businessprocess\_process | Yes | The `` being checked | +| icingacli\_businessprocess\_config | No | Name of the config that contains `` | +| icingaweb\_businessprocess\_as\_tree | No | Whether to show `` as tree or tiles | diff --git a/library/Businessprocess/ProvidedHook/Icingadb/ServiceDetailExtension.php b/library/Businessprocess/ProvidedHook/Icingadb/ServiceDetailExtension.php index ca6bc19..d2fb173 100644 --- a/library/Businessprocess/ProvidedHook/Icingadb/ServiceDetailExtension.php +++ b/library/Businessprocess/ProvidedHook/Icingadb/ServiceDetailExtension.php @@ -46,12 +46,12 @@ class ServiceDetailExtension extends ServiceDetailExtensionHook return HtmlString::create(''); } - $bpName = $service->customvars['businessprocess_config'] ?? null; + $bpName = $service->customvars['icingacli_businessprocess_config'] ?? null; if (! $bpName) { - return HtmlString::create(''); + $bpName = key($this->storage->listProcessNames()); } - $nodeName = $service->customvars['businessprocess_process'] ?? null; + $nodeName = $service->customvars['icingacli_businessprocess_process'] ?? null; if (! $nodeName) { return HtmlString::create(''); } @@ -61,7 +61,7 @@ class ServiceDetailExtension extends ServiceDetailExtensionHook IcingaDbState::apply($bp); - if ($service->customvars['businessprocess_as_tree'] ?? false) { + if ($service->customvars['icingaweb_businessprocess_as_tree'] ?? false) { $renderer = new TreeRenderer($bp, $node); $tag = 'ul'; } else { diff --git a/library/Businessprocess/ProvidedHook/Monitoring/DetailviewExtension.php b/library/Businessprocess/ProvidedHook/Monitoring/DetailviewExtension.php index be7a185..9906df9 100644 --- a/library/Businessprocess/ProvidedHook/Monitoring/DetailviewExtension.php +++ b/library/Businessprocess/ProvidedHook/Monitoring/DetailviewExtension.php @@ -52,12 +52,12 @@ class DetailviewExtension extends DetailviewExtensionHook return ''; } - $bpName = $object->_service_businessprocess_config; + $bpName = $object->_service_icingacli_businessprocess_config; if (! $bpName) { - return ''; + $bpName = key($this->storage->listProcessNames()); } - $nodeName = $object->_service_businessprocess_process; + $nodeName = $object->_service_icingacli_businessprocess_process; if (! $nodeName) { return ''; } @@ -67,7 +67,7 @@ class DetailviewExtension extends DetailviewExtensionHook MonitoringState::apply($bp); - if (filter_var($object->_service_businessprocess_as_tree, FILTER_VALIDATE_BOOLEAN)) { + if (filter_var($object->_service_icingaweb_businessprocess_as_tree, FILTER_VALIDATE_BOOLEAN)) { $renderer = new TreeRenderer($bp, $node); $tag = 'ul'; } else {