← Back to Docs

Get started with heartbeat monitoring

Monibot monitors heartbeats from cron jobs, systemd timers, background tasks and applications.


Create a watchdog in Monibot

  • Log into your Monibot account. If you don't have one, register now, it's free.
  • In the main menu, click on the 'Watchdogs' link. Here you'll see a 'New Watchdog' button.
  • Click the 'New Watchdog' button and enter the data for your heartbeat watchdog:
    • The name, for example 'Database backup'. You can chose any name here, it's used only for display.
    • The heartbeat interval, for example '24h'. This is the interval you expect the heartbeat to come in.
  • Click 'Save'. Your watchdog is now ready and will listen for heartbeats. Please note that we've allocated a unique id for your watchdog. You will need that id in the next step.

Send heartbeats from your server or application

After you have successfully created a watchdog, you are now ready to send heartbeats from your server or application to Monibot. For that, you have a number of options:

  • With our moni command line tool.
  • With curl.
  • With our Go SDK.
  • With any HTTP library of your choice.

Send heartbeats with our moni command line tool

You can use our moni command line tool to send heartbeats from the command line.

$ export MONIBOT_API_KEY=11111111111111
$ moni heartbeat $WATCHDOG_ID

There are two variables you have to include in the moni invocation:

  • MONIBOT_API_KEY. This is your API key. You can find it on your account profile. While you can set the API key directly in the invocation, it's a good practice to set it as an environment variable.
  • WATCHDOG_ID. This is the id of the watchdog you want to send a heartbeat for.

Send heartbeats with curl

You can use curl to send a heartbeat from the command line.

$ curl -X POST https://monibot.io/api/watchdog/$WATCHDOG_ID/heartbeat \
    -H "Authorization: Bearer $MONIBOT_API_KEY"

There are two variables you have to include in the curl invocation:

  • MONIBOT_API_KEY. This is your API key. You can find it on your account profile.
  • WATCHDOG_ID. This is the id of the watchdog you want to send a heartbeat for.

Send heartbeats with our Go (golang) SDK

You can use our Go SDK to send heartbeats programmatically.

func main() {
    // change this to your API key and watchdog id
    const apiKey = "00000000000000000000000000000000"
    const watchdogId = "00000000000000000000000000000000"
    // initialize api
    api := monibot.NewApi(apiKey)
    // send a watchdog heartbeat
    api.PostWatchdogHeartbeat(watchdogId)
}

Send heartbeats with any HTTP library of your choice

You can use any HTTP library to send heartbeats programmatically. Here's a Python example:

import requests;

# change this to your API key and watchdog id
apiKey = '00000000000000000000000000000000'
watchdogId = '00000000000000000000000000000000'

# send POST request
response = requests.post(
    url = 'https://monibot.io/api/watchdog/' + watchdogId + '/heartbeat',
    headers={ 'Authorization': 'Bearer ' + apiKey },
)

# print response
print (response)

# Output: <Response [200]>




If you have a question that is not covered by our docs, please feel free to contact us, we are happy to help.









Made and hosted in Germany
© 2024 monibot.io