Skip to content
Snippets Groups Projects
Select Git revision
  • b673c6000cd22e7026142aa20ac7dc249d2c2aa1
  • main default protected
  • v0.1
3 results

30_Usage.md

Blame
  • Show help

    ./amcli -h
    
       _____ _____ __                   _____         _ _           
      |     |     |  |      ___ ___ ___|     |___ ___|_| |_ ___ ___ 
      |-   -| | | |  |__   | .'| . | . | | | | . |   | |  _| . |  _|
      |_____|_|_|_|_____|  |__,|  _|  _|_|_|_|___|_|_|_|_| |___|_|  
                               |_| |_|            CLI client v0.10
    
    
    This client performs appmonitor checks and puts the results as JSON to stdout.
    It contains all checks that are available in the PHP appmonitor client v0.156.
    You can use the compiled binary to monitor any non PHP webapp without 
    implementing the checks for your programming language.
    
    You need to reference an INI file that contains the metadata and all checks.
    Have a look to the online documentation for details.
    You find example snippets in the source code of this project in tests/config/.
    
      👤 Author: Axel Hahn
      📄 Source: https://git-repo.iml.unibe.ch/iml-open-source/appmonitor-cli-client
      📜 License: GNU GPL 3.0
      📗 Docs: https://os-docs.iml.unibe.ch/appmonitor-cli-client/
    
    (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
        -v, --verbose     Enable verbose output (written to STDERR)
    
        -b, --buildinfos  show build information and exit
        -e, --explain <CHECK>
                          Explain a check and exit
        -l, --list        list available checks and exit
        -m, --modules     list available Php modules in this binary and exit
        -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

    Checks can be defined by writing an INI file that contains meta information and sections for each check. To execute it use the --ini parameter and reference the file (as absolute path or relative to your current working directory).

    [<PATH>]amcli --ini=<FILENAME>

    Recommendations:

    • The output is JSON in a single line. You can use jq to beautify it, eg [<PATH>]amcli --ini=<FILENAME> | jq
    • If the bahaviuor seems to be unwanted use -v to enable verbose mode. You get more debug output during the execution, showing parsed ini file and more. [<PATH>]amcli --ini=<FILENAME> -v

    Exitcodes

    The binary could stop and exit with non zero exitcode.

    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. Maybe just a 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
    7 The key 'function' is not set in the given check. It defines the check function to call.
    8 The section 'meta' has a wrong key or wrong value
    9 The section 'notifications' has a wrong key or wrong value

    appmonitor-client class

    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

    Exitcode Description
    20 Missing key in a given hash
    21 Mising value in a given hash
    22 Check not found. Check your functionvalue
    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