diff --git a/docs/30_Usage.md b/docs/30_Usage.md index efccbe3bed6f3b6aa856047bc8b9a7a16d31e623..efadb8770c1b6efdb066e0fa00788d5dfbce55bc 100644 --- a/docs/30_Usage.md +++ b/docs/30_Usage.md @@ -47,23 +47,6 @@ The infomation for the checks is structured in sections. First an example: ```ini -; ======================================================================= -; -; APPMONITOR CLI CLIENT -; -; to understand the entries of metadata see JSON in -; <https://os-docs.iml.unibe.ch/appmonitor/Client/Description_of_response.html> -; -; for the checks see its parameters -; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html> -; -; ======================================================================= - - -; ----------------------------------------------------------------------- -; METADATA -; ----------------------------------------------------------------------- - [meta] host = "www.example.com" website = "Company website" @@ -76,24 +59,14 @@ email[]="webmaster@example.com" slack["#support-channel"]="https://hooks.slack.com/services/XXXXXX/YYYYYY/ZZZZZ" - ; ----------------------------------------------------------------------- ; CHECKS ; ----------------------------------------------------------------------- ["hello plugin"] -description="I sust wann say hello" +description="I sust wanna say hello" function="hello" - -; JSON example ... variables cannot be expanded -; params='{ -; "message": "Here I am" -; }' -; -; ... but in double quotes the expansion works params[message]="Here is ${USER}" - -; ----------------------------------------------------------------------- ``` #### Types of values diff --git a/docs/40_Embed.md b/docs/40_Embed.md index 669ee6eae0a1fac0181032b9d662d4853ecc0b94..32786b94b049a9da692b239a1417ed8e3e966d42 100644 --- a/docs/40_Embed.md +++ b/docs/40_Embed.md @@ -15,18 +15,35 @@ This code snippet is for demonstration purposes only. A PHP web app should use t ```php <?php -$AMCLI=__DIR__.'/../built_packages/amcli'; -$INI=__DIR__.'/../src/simple.ini'; +$AMCLI = __DIR__ . '/../built_packages/amcli'; +$INI = __DIR__ . '/../src/simple.ini'; -$sCommand="$AMCLI --ini='$INI'"; -$aOut=[]; +$sCommand = "$AMCLI --ini='$INI'"; +$aOut = []; exec($sCommand, $aOut, $iRc); -if($iRc==0){ +if ($iRc == 0) { header('Content-type: application/json'); -}else{ - echo "Error: occured...\n"; +} else { + header("HTTP/1.1 503 Service unavailable"); + echo "<h1>503 Service unavailable</h1>\n"; } echo implode("\n", $aOut); ``` + +To test it: + +(1) + +Start PHP webserver + +```txt +$ cd examples +$ php -S localhost:9000 +[Fri Mar 7 09:01:52 2025] PHP 8.4.4 Development Server (http://localhost:9000) started +``` + +(2) + +In a webbrowser open <http://localhost:9000/embed_example.php>