Cron job Monitoring.

How to send HTTP requests to heartbeat monitor?

Home / Help Center / Cron job monitoring

Cron job or 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 use:

  • Crontab (Unix/Linux)

    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 "" >/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.

      You can also try using the curl method:

      */5 * * * * curl --insecure >/dev/null 2>&1
    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:

    If you encounter a problem with PowerShell command related security/permission issue – where the task is scheduled to run as an admin with highest privilege, you have to add “-NoProfile -ExecutionPolicy Bypass” in the argument. Otherwise, the task itself will run successfully, but the actual PowerShell command included in the task would fail.
    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):
      “Any time you edit the scheduled task, be sure to set the scheduled Trigger time to a future time - if you leave it set in the past it won't run.” When you create the task it defaults to the current time you hit “create task”. By the time you finish creating the task, that time has already past. You need to set the INITIAL start time to a few minutes ahead of the time it currently is when setting up the task.
      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" (by replacing this URL with the URL of the heartbeat monitor)

      Windows Cron Job - Step 3
    5. click ok and save the scheduled task