diff --git a/public_html/client/classes/appmonitor-checks.class.php b/public_html/client/classes/appmonitor-checks.class.php index 2cce207..865a0e8 100755 --- a/public_html/client/classes/appmonitor-checks.class.php +++ b/public_html/client/classes/appmonitor-checks.class.php @@ -227,8 +227,8 @@ protected function _checkArrayKeys($aConfig, $sKeyList) /** * Perform a check - * @param array $aConfig configuration array for a check - * Array + * @param array $aConfig configuration array for a check, eg. + * * [ * [name] => Dummy * [description] => Dummy Test @@ -238,7 +238,7 @@ protected function _checkArrayKeys($aConfig, $sKeyList) * // its keys depend on the function * ] * ] - * + * * @return array */ public function makeCheck(array $aConfig): array diff --git a/public_html/client/git_update_appmonitor.sh b/public_html/client/git_update_appmonitor.sh index fdc069e..bb15c7d 100755 --- a/public_html/client/git_update_appmonitor.sh +++ b/public_html/client/git_update_appmonitor.sh @@ -1,14 +1,21 @@ #!/bin/bash # ====================================================================== # -# UPDATE APPMONITOR CLIENT +# A P P M O N I T O R :: CLIENT - UPDATE # -# requires git, rsync +# This script will install or update the appmonitor client only. +# +# Below the document root of a website create a new directory, +# i.e. [webroot]/appmonitor/ and copy this script there. +# Change the directory "cd [webroot]/appmonitor/" and execute it. # # ---------------------------------------------------------------------- -# 2022-04-11 first lines -# 2022-04-12 add help; exclude unneeded files -# 2022-05-03 create general_include.php +# requires git, rsync +# ---------------------------------------------------------------------- +# 2022-04-11 0.1 first lines +# 2022-04-12 0.2 add help; exclude unneeded files +# 2022-05-03 0.3 create general_include.php +# 2024-07-25 0.4 update quoting and comments # ====================================================================== # ---------------------------------------------------------------------- @@ -16,14 +23,14 @@ # ---------------------------------------------------------------------- readonly git_repo_url="https://github.com/iml-it/appmonitor.git" -readonly line="____________________________________________________________" -readonly version="0.3" +readonly line="______________________________________________________________________________" +readonly version="0.4" git_target=/tmp/git_data__appmonitor client_from="${git_target}/public_html/client" client_to="." -cd $( dirname "$0" ) || exit 1 +cd "$( dirname "$0" )" || exit 1 # ---------------------------------------------------------------------- # FUNCTIONS @@ -99,6 +106,9 @@ case "$1" in This is a helper script to get the files of the IML Appmonitor client part only. + Below the document root of a website create a new directory, + i.e. [webroot]/appmonitor/ and copy this script there. + This script clones and updates the repository in the /tmp directory and syncs the client files of it to a given directory. @@ -165,7 +175,7 @@ _fileupdate general_include.sample.php echo $line echo ">>> #3 of 3 >>> Diff" echo -diff -r "$client_from" "$client_to" +diff --color -r "$client_from" "$client_to" echo diff --git a/public_html/client/plugins/checks/loadmeter.php b/public_html/client/plugins/checks/loadmeter.php index d318ae3..13911af 100755 --- a/public_html/client/plugins/checks/loadmeter.php +++ b/public_html/client/plugins/checks/loadmeter.php @@ -44,6 +44,7 @@ * * 2019-06-06 * 2024-07-23 php 8 only: use typed variables + * 2024-07-25 float return with 2 digits behind comma * */ class checkLoadmeter extends appmonitorcheck @@ -132,12 +133,12 @@ public function run(array $aParams): array // return [ $iResult, - ($fLoad === false ? 'load value is not available' : 'current load is: ' . $fLoad), + ($fLoad === false ? 'load value is not available' : 'current load is: ' . round($fLoad, 2)), ($fLoad === false ? [] : [ 'type' => 'counter', - 'count' => $fLoad, + 'count' => round($fLoad, 2), 'visual' => 'line', ] ) diff --git a/public_html/server/classes/appmonitor-server-gui.class.php b/public_html/server/classes/appmonitor-server-gui.class.php index 557e5cf..d71227a 100755 --- a/public_html/server/classes/appmonitor-server-gui.class.php +++ b/public_html/server/classes/appmonitor-server-gui.class.php @@ -470,9 +470,9 @@ protected function _generateWebappTiles(string $sAppId): string : ''; break; case 'receiver': - $this->oNotification->setApp($sAppId, $this->_data[$sAppId]); + $this->oNotification->setApp($sAppId); $aEmailNotifiers = $this->oNotification->getAppNotificationdata('email'); - $aSlackChannels = $this->oNotification->getAppNotificationdata('slack', 1); + $aSlackChannels = $this->oNotification->getAppNotificationdata('slack'); // $aPeople=[ 'email1@example.com', 'email2@example.com' ]; $sMoreNotify = (count($aEmailNotifiers) ? '' . count($aEmailNotifiers) . ' x ' . $this->_aIco['notify-email'] . ' ' : '') @@ -1261,7 +1261,7 @@ protected function _renderCounter(string $sAppId, string $sCounterId, array $aOp 'xValue' => false, 'yGrid' => false, - 'yLabel' => $aOptions['label'], + // 'yLabel' => $aOptions['label'], 'yLabel' => false, 'yValue' => false, @@ -1846,6 +1846,7 @@ public function _access_denied(string $sMessage): string 'text' => $sMessage, ]); } + return ''; } /** @@ -2026,7 +2027,7 @@ function _generateWeblist(bool $bSkipOk = false, array $aOptions = []): array $aTags = $aEntries["meta"]["tags"] ?? false; $sTaglist = $aTags ? $this->_getTaglist($aTags) : ''; - $this->oNotification->setApp($sAppId, $this->_data[$sAppId]); + $this->oNotification->setApp($sAppId); $aLastStatus = $this->oNotification->getAppLastResult(); $sSince = isset($aLastStatus['laststatus']['result']['ts']) @@ -2208,7 +2209,7 @@ public function generateViewWeblist(): string * it is used to build an url; the "-" will be used to parse the app id * * @param string $sAppid - * @return type + * @return string */ protected function _getDivIdForApp(string $sAppid): string { diff --git a/public_html/server/classes/appmonitor-server.class.php b/public_html/server/classes/appmonitor-server.class.php index 6c99740..18b1f0c 100755 --- a/public_html/server/classes/appmonitor-server.class.php +++ b/public_html/server/classes/appmonitor-server.class.php @@ -81,7 +81,7 @@ class appmonitorserver /** * name of the config file to load - * @var type + * @var string */ protected string $_sConfigfile = "appmonitor-server-config.json"; diff --git a/public_html/server/classes/render-adminlte.class.php b/public_html/server/classes/render-adminlte.class.php index 7b78f91..8be1291 100755 --- a/public_html/server/classes/render-adminlte.class.php +++ b/public_html/server/classes/render-adminlte.class.php @@ -90,7 +90,7 @@ class renderadminlte public function __construct() { $this->_oHtml = new htmlelements(); - return true; + //return true; } // ---------------------------------------------------------------------- @@ -108,6 +108,7 @@ public function __construct() * @param string $sType type; key in $_aValidItems; one of color|type * @param string $sValue value to check * @param string $sReferrer optional: method that called this function + * @return bool */ protected function _checkValue($sType, $sValue, $sReferrer = false) { @@ -131,7 +132,7 @@ protected function _checkValue($sType, $sValue, $sReferrer = false) /** * return a alert box * https://adminlte.io/themes/AdminLTE/pages/UI/general.html - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|info|primary|success|warning * - dismissible - if dismissible - one of true|false; default: false * - title @@ -169,7 +170,7 @@ public function getAlert($aOptions) /** * get html code for a badge - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|info|primary|success|warning * - bgcolor - background color (without prefix "bg") * - class - css class @@ -202,7 +203,7 @@ public function getBadge($aOptions) /** * return a callout box * https://adminlte.io/themes/AdminLTE/pages/UI/general.html - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|info|primary|success|warning * - title * - text @@ -235,7 +236,7 @@ public function getCallout($aOptions) /** * return a content Box - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - one of [none]|danger|info|primary|success|warning * - solid - one of true|false; default: false * - collapsable - one of true|false; default: false @@ -295,6 +296,20 @@ public function getBox($aOptions) } + + /** + * Generates a menu item with a label and link options. + * + * @param array $aOptions The options for the menu item. + * - 'class' (string): The CSS class for the menu item. + * - 'label' (string): The label for the menu item. + * @param array $aLinkOptions The options for the link. + * - 'href' (string): The URL for the link. + * - 'text' (string): The text for the link. + * - 'class' (string): The CSS class for the link. + * - 'icon' (string): The icon for the link. + * @return string The generated menu item. + */ public function getMenuItem($aOptions, $aLinkOptions) { $sLabel = $this->_oHtml->getTag('a', $aLinkOptions); @@ -332,7 +347,7 @@ public function getMenuItem($aOptions, $aLinkOptions) /** * return a small Box - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - type - icon color one of [none]|aqua|green|yellow|red * - bgcolor - background color one of [none]|aqua|green|yellow|red * - color - icon color one of [none]|aqua|black|gray|green|orange|maroon|navy|purple|red|teal|yellow @@ -368,7 +383,7 @@ public function getSmallBox($aOptions) } /** * return a widget - * @param type $aOptions hash with keys for all options + * @param array $aOptions hash with keys for all options * - bgcolor - icon color one of aqua|green|yellow|red * - color - icon color one of aqua|black|gray|green|orange|maroon|navy|purple|red|teal|yellow * - onclick @@ -452,7 +467,7 @@ public function getSectionRow($sContent = false, $sId=false) * get html code for headline of page content * * @param string $sHeadline headline as html - * @return type + * @return string */ public function getSectionHead($sHeadline) { diff --git a/scripts/generate_class_docs.sh b/scripts/generate_class_docs.sh index 966a6a0..62c2a4a 100755 --- a/scripts/generate_class_docs.sh +++ b/scripts/generate_class_docs.sh @@ -54,7 +54,7 @@ function docgen(){ echo "----- $myfile" echo " $outfile" - ./parse-class.php --debug --out md "$APPDIR/$myfile" > "$outfile" + ./parse-class.php --out md "$APPDIR/$myfile" > "$outfile" echo } @@ -62,6 +62,9 @@ function docgen(){ # MAIN # ---------------------------------------------------------------------- + +# ./parse-class.php --out md "$APPDIR/public_html/server/classes/appmonitor-server.class.php"; exit + # generate all docs for myfile in $clientClassfiles do