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')){ ...@@ -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> * 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> * 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> * 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> * --------------------------------------------------------------------------------<br>
* @version 0.111 * @version 0.128
* @author Axel Hahn * @author Axel Hahn
* @link TODO * @link TODO
* @license GPL * @license GPL
...@@ -55,7 +56,7 @@ class appmonitor { ...@@ -55,7 +56,7 @@ class appmonitor {
* value is in seconds * value is in seconds
* @var int * @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 * config: default ttl for server before requesting the client check again
...@@ -86,7 +87,7 @@ class appmonitor { ...@@ -86,7 +87,7 @@ class appmonitor {
/** /**
* for time measurements: start time * for time measurements: start time
* @var type * @var float
*/ */
protected $_iStart = false; protected $_iStart = false;
......
...@@ -206,6 +206,32 @@ if(isset($aConfig['foreman']['api'])){ ...@@ -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 // ssh targets
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
* ____________________________________________________________________________ * ____________________________________________________________________________
* *
* 2019-06-07 <axel.hahn@iml.unibe.ch> * 2019-06-07 <axel.hahn@iml.unibe.ch>
* 2022-07-06 <axel.hahn@iml.unibe.ch> set group "monitor"
* *
*/ */
class checkApacheProcesses extends appmonitorcheck{ class checkApacheProcesses extends appmonitorcheck{
...@@ -84,7 +85,7 @@ class checkApacheProcesses extends appmonitorcheck{ ...@@ -84,7 +85,7 @@ class checkApacheProcesses extends appmonitorcheck{
* @return array * @return array
*/ */
public function getGroup(){ public function getGroup(){
return 'services'; return 'monitor';
} }
/** /**
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* *
* 2021-10-26 <axel.hahn@iml.unibe.ch> * 2021-10-26 <axel.hahn@iml.unibe.ch>
* 2022-12-21 <axel.hahn@unibe.ch> add flag sslverify * 2022-12-21 <axel.hahn@unibe.ch> add flag sslverify
* 2023-07-06 <axel.hahn@unibe.ch> add flag userpwd
* *
*/ */
class checkHttpContent extends appmonitorcheck{ class checkHttpContent extends appmonitorcheck{
...@@ -40,6 +41,7 @@ class checkHttpContent extends appmonitorcheck{ ...@@ -40,6 +41,7 @@ class checkHttpContent extends appmonitorcheck{
* @param array $aParams * @param array $aParams
* [ * [
* url string url to fetch * url string url to fetch
* userpwd string set user and password; syntax: "[username]:[password]"
* timeout integer optional timeout in sec; default: 5 * timeout integer optional timeout in sec; default: 5
* headeronly boolean optional flag to fetch http response herader only; default: false = returns header and body * 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 * follow boolean optional flag to follow a location; default: false = do not follow
...@@ -68,6 +70,10 @@ class checkHttpContent extends appmonitorcheck{ ...@@ -68,6 +70,10 @@ class checkHttpContent extends appmonitorcheck{
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, isset($aParams["sslverify"]) ? !!$aParams["sslverify"] : 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); 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); $res = curl_exec($ch);
if (!$res) { if (!$res) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment