Skip to content
Snippets Groups Projects
Commit d0aa7e61 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '6421-update-appmonitor-checks' into 'master'

6421 update appmonitor checks

See merge request !52
parents ced0ba4a cb2fcff9
No related branches found
No related tags found
1 merge request!526421 update appmonitor checks
Pipeline #1597 passed
......@@ -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;
......
......@@ -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
// ----------------------------------------------------------------------
......
......@@ -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';
}
/**
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment