diff --git a/Usage.md b/Usage.md new file mode 100644 index 0000000000000000000000000000000000000000..5ba700472e53e8f6d19a1e6d33122bc7b471e13c --- /dev/null +++ b/Usage.md @@ -0,0 +1,70 @@ +# Usage of amcli + +## Show help + +```text +./src/amcli -h +IML Appmonitor as CLI client 0.1 + +This client performs appmonitor checks and puts the results as JSON to stdout. +You can use the compiled binary on non PHP systems. +(c) 2025 Institute for Medical education * University of Bern + +SYNTAX: amcli [OPTIONS] --ini=<INI-FILE> + +OPTIONS: + -h, --help Print this help and exit + -i, --ini Set an INI File to parse + -l, --list list available checks and exit + -m, --modules list available Php modules in this binary and exit + -v, --verbose Enable verbose output + -V, --version Show version and exit + +EXAMPLES: + + amcli -i=my.ini + amcli --ini=my.ini + Execute checks from INI file 'my.ini'. + + amcli --list + List available checks. + +``` + +## Execute checks + +`amcli --ini=<FILENAME>` + +## Exitcodes + +### amcli + +| Exitcode | Description +| --- | --- +| 0 | OK. An option was executed (help, list modules or checks) or the check was executed successfully +| 1 | include include_checks.php failed (php file only) +| 2 | include_checks.php failed (php file only) +| 3 | INI file was not given. Or missing `=` char in `--ini=<FILE>` +| 4 | Given Ini file does not exist +| 5 | Given Ini file cannot be parsed +| 6 | Ini value `params=` is no JSON + +### appmonitor-client.class.php + +| Exitcode | Description +| --- | --- +| 10 | incomplete reponse data detected eg. no check, no result code +| 11 | Access denied: Ip restriction was set +| 12 | Access denied: No token or wrong token was given + +### appmonitor-checks.class.php + +| Exitcode | Description +| --- | --- +| 20 | Missing key in a given hash +| 21 | Mising value in a given hash +| 22 | Check not found. Check your `function`value +| 23 | Check didn't response a hash (=error in check) +| 24 | Check responded a too small hash (=error in check) +| 25 | The unit in a space value is unknown +