← Back to Docs

The moni command line tool

The moni command line tool ('moni' for short') is a small program that you can run on your server. It's light on resources, small, and easy to setup. The tool can be used to query machines, watchdogs and metrics from Monibot, as well as upload machine samples, watchdog heartbeats and metric values to Monibot.

Moni is open-source and hosted on github https://github.com/cvilsmeier/moni. You can build it manually (see instructions there) or download a precompiled Linux/Amd64 binary from https://github.com/cvilsmeier/moni/releases/latest

Once downloaded, copy moni to a suitable place, for instance:

user@host:~$ mkdir monibot
user@host:~$ mv Downloads/moni-linux-amd64.tar.gz monibot/
user@host:~$ cd monibot/
user@host:~/monibot$ tar -xf moni-linux-amd64.tar.gz

Test the installation with the following command:

user@host:~/monibot$ ./moni
Moni - A command line tool for https://monibot.io

Usage

    moni [flags] command

Flags

    -url
        Monibot URL, default is "https://monibot.io".
        You can set this also via environment variable MONIBOT_URL.

    -apiKey
        Monibot API Key, default is "".
        You can set this also via environment variable MONIBOT_API_KEY (recommended).
        You can find your API Key in your profile on https://monibot.io.
        Note: For security, we recommend that you specify the API Key
        via MONIBOT_API_KEY, and not via -apiKey flag. The flag will show up in
        'ps aux' outputs and can be eavesdropped.

    -trials
        Max. Send trials, default is 12.
        You can set this also via environment variable MONIBOT_TRIALS.

    -delay
        Delay between trials, default is 5s.
        You can set this also via environment variable MONIBOT_DELAY.

    -v
        Verbose output, default is false.
        You can set this also via environment variable MONIBOT_VERBOSE ('true' or 'false').

Commands

    ping
        Ping the Monibot API. If an error occurs, moni will print
        that error. It it succeeds, moni will print nothing.

    watchdogs
        List heartbeat watchdogs.

    watchdog 
        Get heartbeat watchdog by id.

    beat  [interval]
        Send a heartbeat. If interval is not specified,
        moni sends one heartbeat and exits. If interval is
        specified, moni will stay in the background and send
        heartbeats in that interval

    machines
        List machines.

    machine 
        Get machine by id.

    sample  
        Send resource usage (load/cpu/mem/disk) samples for machine.
        Moni consults various files (/proc/loadavg, /proc/cpuinfo, etc.)
        and commands (/usr/bin/free, /usr/bin/df, etc.) to calculate
        resource usage. Therefore it currently supports linux only.
        Moni will stay in background and keep sampling in specified
        interval.

    metrics
        List metrics.

    metric 
        Get and print metric info.

    inc  
        Increment a Counter metric.
        Value must be a non-negative 64-bit integer value.

    set  
        Set a Gauge metric.
        Value must be a non-negative 64-bit integer value.

    config
        Show config values.

    version
        Show moni program version.

    sdk-version
        Show the monibot-go SDK version moni was built with.

    help
        Show this help page.

Exit Codes
    0 ok
    1 error
    2 wrong user input








Made and hosted in Germany
© 2024 monibot.io