Cron jobs or heartbeat monitoring is a great way to monitor intranet servers/computers/devices that are connected to the internet.
And, besides that, it also allows us to monitor the health of the regular actions (cron jobs, background processes, etc.) our website/app/system performs.
It works the opposite way compared to other monitor types: instead of UptimeRobot checking your service, your server or job sends regular HTTP requests to the heartbeat URL. If UptimeRobot doesn't receive a request within the monitor's interval, the monitor goes down. You'll find the heartbeat URL in the monitor's details after creating a Heartbeat monitor.
For sending these regular HTTP requests, you can use:
Crontab (Unix/Linux)
Crontab (Unix/Linux)
In order to create/edit a cron job:
Connect to the server/computer with SSH
Type
crontab -eSelect the editor of choice from the displayed list
Append the entry like:
*/5 * * * * wget --spider "https://heartbeat.uptimerobot.com/m794yyyyyyyy-xxxxxxxxxxxxxxx" >/dev/null 2>&1
by replacing the URL with the URL of the heartbeat monitor and also replace 5 in */5 with your monitor's interval in minutes.
You can also try using the curl method:
*/5 * * * * curl --insecure https://heartbeat.uptimerobot.com/m794yyyyyyyy-xxxxxxxxxxxxxxx >/dev/null 2>&1
Save and close the file (no need to restart)
Task Scheduler (Windows)
Task Scheduler (Windows)
This built-in Windows feature allows triggering actions and programs every x minutes. Windows 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 a PowerShell command related to security/permission issues – where the task is scheduled to run as an admin with the highest privilege- you have to add “-NoProfile -ExecutionPolicy Bypass” in the arguments. Otherwise, the task itself will run successfully, but the actual PowerShell command included in the task will 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:
3. Create a new trigger that will run every x minutes (where x must be the interval of the monitor).
Note: 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 passed. You need to set the INITIAL start time to a few minutes ahead of the time it currently is when setting up the task.
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/m794yyyyyyyy-xxxxxxxxxxxxxxx"(by replacing this URL with the URL of the heartbeat monitor)
5. Click ok and save the scheduled task.



