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

Merge branch 'appmonitor-fix' into 'master'

Appmonitor fix

See merge request !102
parents 65303135 2920fd38
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* 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>
* --------------------------------------------------------------------------------<br> * --------------------------------------------------------------------------------<br>
* @version 0.91 * @version 0.92
* @author Axel Hahn * @author Axel Hahn
* @link TODO * @link TODO
* @license GPL * @license GPL
...@@ -51,7 +51,7 @@ class appmonitor { ...@@ -51,7 +51,7 @@ class appmonitor {
* value is in seconds * value is in seconds
* @var int * @var int
*/ */
protected $_sVersion = 'php-client-v0.91'; protected $_sVersion = 'php-client-v0.92';
/** /**
* config: default ttl for server before requesting the client check again * config: default ttl for server before requesting the client check again
......
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
* *
* ____________________________________________________________________________ * ____________________________________________________________________________
* *
* SHOW LOAD AS LINE * SHOW COUNT OF ACTIVE APACHE PROCESSES
*
* A plugin always is loaded in clases/appmonitor-checks.class.php
* Have look there for the used protected classes
* ____________________________________________________________________________ * ____________________________________________________________________________
* *
* PARAMS: * PARAMS:
...@@ -36,8 +33,8 @@ ...@@ -36,8 +33,8 @@
* "function" => "ApacheProcesses", * "function" => "ApacheProcesses",
* "params" => array( * "params" => array(
* "url" => "https://localhost/status", * "url" => "https://localhost/status",
* "warning" => 30, * "warning" => 75,
* "error" => 50, * "error" => 90,
* ), * ),
* ), * ),
* "worstresult" => RESULT_OK * "worstresult" => RESULT_OK
...@@ -109,12 +106,18 @@ class checkApacheProcesses extends appmonitorcheck{ ...@@ -109,12 +106,18 @@ class checkApacheProcesses extends appmonitorcheck{
if($iActive===false){ if($iActive===false){
$iResult=RESULT_UNKNOWN; $iResult=RESULT_UNKNOWN;
} else { } else {
$sComment='';
$iTotal=$aProcesses['total'];
$iResult=RESULT_OK; $iResult=RESULT_OK;
if($iActive>$this->_iWarn){ if(($iActive/$iTotal*100)>$this->_iWarn){
$iResult=RESULT_WARNING; $iResult=RESULT_WARNING;
$sComment='more than warning level '.$this->_iWarn.'%';
} else {
$sComment='less than warning level '.$this->_iWarn.'%';
} }
if($iActive>$this->_iError){ if(($iActive/$iTotal*100)>$this->_iError){
$iResult=RESULT_ERROR; $iResult=RESULT_ERROR;
$sComment='more than error level '.$this->_iError.'%';
} }
} }
...@@ -132,7 +135,7 @@ class checkApacheProcesses extends appmonitorcheck{ ...@@ -132,7 +135,7 @@ class checkApacheProcesses extends appmonitorcheck{
// //
return array( return array(
$iResult, $iResult,
($iActive===false ? 'Apache httpd server status is not available' : 'apache processes: '.print_r($aProcesses, 1)), ($iActive===false ? 'Apache httpd server status is not available' : 'apache processes: '.print_r($aProcesses, 1)).' '.$sComment,
($iActive===false ($iActive===false
? array() ? array()
: array( : array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment