diff --git a/public_html/appmonitor/classes/appmonitor-client.class.php b/public_html/appmonitor/classes/appmonitor-client.class.php index 7b026cf6f9f2d18f504148e6983d5844944450ee..08a584241e83d9b1f5933a08bbf5fcb9a2c6a966 100755 --- a/public_html/appmonitor/classes/appmonitor-client.class.php +++ b/public_html/appmonitor/classes/appmonitor-client.class.php @@ -40,8 +40,9 @@ if (!class_exists('appmonitorcheck')){ * 2018-11-05 0.58 axel.hahn@iml.unibe.ch additional flag in http check to show content<br> * 2019-05-31 0.87 axel.hahn@iml.unibe.ch add timeout as param in connective checks (http, tcp, databases)<br> * 2020-05-03 0.110 axel.hahn@iml.unibe.ch update renderHtmloutput<br> + * 2023-07-06 0.128 axel.hahn@unibe.ch update httpcontent check<br> * --------------------------------------------------------------------------------<br> - * @version 0.111 + * @version 0.128 * @author Axel Hahn * @link TODO * @license GPL @@ -55,7 +56,7 @@ class appmonitor { * value is in seconds * @var int */ - protected $_sVersion = 'php-client-v0.111'; + protected $_sVersion = 'php-client-v0.128'; /** * config: default ttl for server before requesting the client check again @@ -86,7 +87,7 @@ class appmonitor { /** * for time measurements: start time - * @var type + * @var float */ protected $_iStart = false; diff --git a/public_html/appmonitor/index.php b/public_html/appmonitor/index.php index 1e075077871e65c1853e198475601f604d2e023e..4835485eb8c9cf577dae0bd5db9a3c2cf9424bdb 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 // ---------------------------------------------------------------------- diff --git a/public_html/appmonitor/plugins/checks/apacheprocesses.php b/public_html/appmonitor/plugins/checks/apacheprocesses.php index aba2f3e657d1355080872511cd9bf9112f6cae07..2b6809be276012e285adf695411133773e645637 100755 --- a/public_html/appmonitor/plugins/checks/apacheprocesses.php +++ b/public_html/appmonitor/plugins/checks/apacheprocesses.php @@ -43,6 +43,7 @@ * ____________________________________________________________________________ * * 2019-06-07 <axel.hahn@iml.unibe.ch> + * 2022-07-06 <axel.hahn@iml.unibe.ch> set group "monitor" * */ class checkApacheProcesses extends appmonitorcheck{ @@ -84,7 +85,7 @@ class checkApacheProcesses extends appmonitorcheck{ * @return array */ public function getGroup(){ - return 'services'; + return 'monitor'; } /** diff --git a/public_html/appmonitor/plugins/checks/httpcontent.php b/public_html/appmonitor/plugins/checks/httpcontent.php index abbf1d779067801d619aedb62780321ed2c24397..037adf6c48055e50396ef0fc693896771a853146 100755 --- a/public_html/appmonitor/plugins/checks/httpcontent.php +++ b/public_html/appmonitor/plugins/checks/httpcontent.php @@ -19,6 +19,7 @@ * * 2021-10-26 <axel.hahn@iml.unibe.ch> * 2022-12-21 <axel.hahn@unibe.ch> add flag sslverify + * 2023-07-06 <axel.hahn@unibe.ch> add flag userpwd * */ class checkHttpContent extends appmonitorcheck{ @@ -40,6 +41,7 @@ class checkHttpContent extends appmonitorcheck{ * @param array $aParams * [ * url string url to fetch + * userpwd string set user and password; syntax: "[username]:[password]" * timeout integer optional timeout in sec; default: 5 * headeronly boolean optional flag to fetch http response herader only; default: false = returns header and body * follow boolean optional flag to follow a location; default: false = do not follow @@ -68,6 +70,10 @@ class checkHttpContent extends appmonitorcheck{ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, isset($aParams["sslverify"]) ? !!$aParams["sslverify"] : 1); curl_setopt($ch, CURLOPT_TIMEOUT, (isset($aParams["timeout"]) && (int)$aParams["timeout"]) ? (int)$aParams["timeout"] : $this->_iTimeoutTcp); + if (isset($aParams["userpwd"])){ + curl_setopt($ch, CURLOPT_USERPWD, $aParams["userpwd"]); + } + $res = curl_exec($ch); if (!$res) {