Heartbeat Monitoring.

How to send regular HTTP requests?

Heartbeat monitoring is a great way to monitor intranet servers/computers/devices which are connected to the internet.

And, besides that, it also allows us to monitor the health of the regular actions (cron jobs, background processes..) our website/app/system performs.

It works in an opposite way compared to the other monitoring types as it requires the monitor to send the requests so that Uptime Robot can decide if it is up or down.

And, for sending these regular HTTP requests you can setup:

  • Cron jobs (Unix/Linux)

    It is needed to use the crontab command for creating and managing crons jobs.

    In order to create/edit a cron job:

    1. connect to the server/computer with SSH
    2. type crontab -e
    3. select the editor of choice from the displayed list
    4. Append the entry like:
      */5 * * * * wget --spider "https://heartbeat.uptimerobot.com/m1616982-1d6f73e6a50d64d3491db9b3e7009b4af279d1at" >/dev/null 2>&1
      by replacing the URL with the URL of the heartbeat monitor and also replacing the /5 part with the interval value of the monitor
    5. save and close the file (no need to restart)
  • Task scheduler (Windows)

    This built-in Windows feature allows triggering actions and programs every x minutes. Window's Powershell can easily send HTTP requests and they can both be used in combination to send regular HTTP requests with steps:

    1. open the task scheduler app and create a new task
    2. make sure the task will run even if no user is logged-in:
      Windows Cron Job - Step 1
    3. create a new trigger that will run every x minutes (where x must be the interval of the monitor):
      Windows Cron Job - Step 2
    4. create a new action that will run Powershell to send HTTP requests and please enter the values:
      • Program/script: powershell.exe
      • Add Arguments: >-Command "Invoke-WebRequest https://heartbeat.uptimerobot.com/m1616982-1d6f73e6a50d64d3491db9b3e7009b4af279d1at" (by replacing this URL with the URL of the heartbeat monitor)

      Windows Cron Job - Step 3

    5. click ok and save the scheduled task