From 242993087e38b4922d2175be09d0c4ad92b10e53 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Fri, 20 Dec 2024 16:45:09 +0100 Subject: [PATCH] #7709 - update appmomitor client check for instances per rollout plugin --- public_html/appmonitor/index.php | 39 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/public_html/appmonitor/index.php b/public_html/appmonitor/index.php index 422c047b..5d23ccf3 100644 --- a/public_html/appmonitor/index.php +++ b/public_html/appmonitor/index.php @@ -230,30 +230,33 @@ if(isset($aConfig['foreman']['api'])){ } // #6421 - add check for AWX +// #7709 - update for instances per rollout plugin if(isset($aConfig['plugins']['rollout']['awx'])){ $aOpts=[]; - $aOpts['url'] = $aConfig['plugins']['rollout']['awx']['url'].'/'; - if(isset($aConfig['plugins']['rollout']['awx']['user'])){ - $aOpts['userpwd'] = $aConfig['plugins']['rollout']['awx']['user'] - . (isset($aConfig['plugins']['rollout']['awx']['password']) - ? ':'.$aConfig['plugins']['rollout']['awx']['password'] + foreach ($aConfig['plugins']['rollout'] as $sId => $aRolloutConfig) { + if ($aRolloutConfig['plugin'] == "awx") { + $aOpts['url'] = $aRolloutConfig['url'].'/'; + $aOpts['userpwd'] = $aRolloutConfig['user'] + . (isset($aRolloutConfig['password']) + ? ':'.$aRolloutConfig['password'] : '' ) ; - } - $oMonitor->addCheck( - [ - "name" => "AWX API", - "description" => "check if AWX api is available", - "group" => "network", - "parent" => "read config file", - "check" => [ - "function" => "HttpContent", - "params" => $aOpts, - ], - ] - ); + $oMonitor->addCheck( + [ + "name" => "AWX API - ".$sId, + "description" => "check if AWX api is available", + "group" => "network", + "parent" => "read config file", + "check" => [ + "function" => "HttpContent", + "params" => $aOpts, + ], + ] + ); + } + } } // ---------------------------------------------------------------------- -- GitLab