← Back to Docs

Monitoring

Monitoring is at the heart of Monibot's features. Monibot monitors websites, SSL certificates, Watchdog heartbeats, server machines and custom metrics. The following sections describe each monitoring in detail:


Website Monitoring

Monibot checks websites by sending a HTTP request every five minutes and checking the response code. If the response code is not equal to 200 (200 means 'OK' in HTTP speak), or the response takes too long to arrive back, then Monibot will notify you.

You create a website monitor by specifiying its human-friendly name for display, an URL (http:// or https://) and a timeout value. That's it. From now on, Monibot will check that URL periodically.

While checking a website, Monibot stores all ups and downs and response latencies (the number of milliseconds it takes for a response to arrive) in its database, aggregates these numbers, and shows them in a 30-days chart. This chart helps you to find out if your website becomes slower or faster.


SSL Certificate Monitoring

Monibot checks SSL certificates ('certs' for short) by fetching the cert data from the remote server every hour and checking the cert's expiration date. If the cert is expired or will expire in less than five days, Monibot will notify you.


Watchdog Heartbeats

Watchdogs are used to ensure that periodic tasks, like cronjobs, are indeed executed successfully. Within Monibot, you can set up a watchdog by giving a human-friendly name for display and a time interval. Monibot then awaits heartbeats for this watchdog. If no heartbeat comes within time, something might be wrong with your server-side cronjob, or background task executor, and Monibot will notify you.

From within your server or app, you can send heartbeats with curl, our moni command line tool, or from within your app, using our REST API. If you are using Go, you can use the official Go SDK at https://github.com/cvilsmeier/monibot-go.

A sample curl invocation on linux would look like this:

curl -X POST https://monibot.io/api/watchdog/$WATCHDOG_ID/heartbeat \
    -H "Authorization: Bearer $MONIBOT_API_KEY"
where the environmant variable WATCHDOG_ID holds the id of the heartbeat watchdog and MONIBOT_API_KEY holds the API-Key of the user (you).

A sample moni invocation that does the same, would look like this:

moni heartbeat $WATCHDOG_ID

A sample moni invocation that sends a heartbeat every hour would look like this:

moni heartbeat $WATCHDOG_ID 1h


Machine Resource Monitoring

Machines are used to keep an eye on server machines where your app is running. Machines will send periodic resource usage samples to Monibot. Monibot then stores all numbers in its database, aggregates them and presents them in various charts. You can then check if your servers a running out of CPU, memory or disk space, or if your server's clock goes wrong.

Specifically, Monibot collects the following numbers:

  • CPU usage %
  • Memory usage %
  • Disk usage %
  • Load Avg for 1 minute, 5 minutes and 15 minutes, more on this here
  • Clock skew in seconds

A sample curl invocation on linux would look like this:

curl -X POST https://monibot.io/api/watchdog/$MACHINE_ID/sample \
    -H "Authorization: Bearer $MONIBOT_API_KEY" \
    -d "tstamp=1698776326871" \
    -d "load1=0.73" \
    -d "load5=0.54" \
    -d "load15=0.12" \
    -d "cpu=62" \
    -d "mem=43" \
    -d "disk=12"
where the environmant variable MACHINE_ID holds the id of the heartbeat watchdog and MONIBOT_API_KEY holds the API-Key of the user (you).

While you can theoretically send machine data via curl, a more convenient option is to use our moni command line tool. A sample invocation looks like this:

moni sample $MACHINE_ID 5m
By issuing this command, the moni command line tool will collect all resource usage data, upload it to Monibot, sleep five minutes, and then start over again.

To start sampling when your server boots up, add the following line to your crontab:

@reboot /path/to/moni sample $MACHINE_ID 5m
where /path/to is the directory where the moni binary is stored.


Custom Metrics

Metrics are numbers that your app produces. Monibot can collect, aggregate and visualize these numbers. For example, your app can send metrics like DB size, number of registered users, number of failed database transactions, number of active user sessions, and so on.

Monibot supports 'counter' metrics and 'gauge' metrics.

A counter metric can only be incremented. Examples are number of served HTTP requests and number of database transactions. A sample curl command to increment a counter looks like this:

curl -X POST https://monibot.io/api/metric/$METRIC_ID/inc \
    -H "Authorization: Bearer $MONIBOT_API_KEY" \
    -d "value=42"

or with moni:

moni inc $METRIC_ID 42
The value must be a non-negative integer value, and METRIC_ID must hold the id of the counter metric to be incremented.

A gauge metric is a value that can increase and decrease over time, for example DB size or number of registered users. A sample curl command to set a gauge looks like this:

curl -X POST https://monibot.io/api/metric/$METRIC_ID/set \
    -H "Authorization: Bearer $MONIBOT_API_KEY" \
    -d "value=13978"

or with moni:

moni set $METRIC_ID 13978
The value must be a non-negative integer value, and METRIC_ID must hold the id of the gauge metric to be set.








Made and hosted in Germany
© 2024 monibot.io