From ddfa77222defad749e8eaa4badf48589fca36d7f Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Thu, 6 Jul 2023 16:57:14 +0200
Subject: [PATCH] add check for awx

---
 public_html/appmonitor/index.php | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/public_html/appmonitor/index.php b/public_html/appmonitor/index.php
index 1e075077..4835485e 100644
--- a/public_html/appmonitor/index.php
+++ b/public_html/appmonitor/index.php
@@ -206,6 +206,32 @@ if(isset($aConfig['foreman']['api'])){
     }
 }
 
+// #6421 - add check for AWX
+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']
+                : ''
+            )
+            ;
+    }
+
+    $oMonitor->addCheck(
+        array(
+            "name" => "AWX API",
+            "description" => "check if AWX api is available",
+            "group" => "network",
+            "check" => array(
+                "function" => "HttpContent",
+                "params" => $aOpts,
+            ),
+        )
+    );
+}
+
 // ----------------------------------------------------------------------
 // ssh targets
 // ----------------------------------------------------------------------
-- 
GitLab