Heartbeat Monitoring (Cron)
Monitor background jobs, backups, and scheduled tasks by waiting for a ping.
Heartbeat Monitoring
Heartbeat monitoring (also known as Cron Monitoring) works in reverse: instead of us checking your server, your server (or script) notifies us that it is alive.
This is perfect for monitoring:
- Daily Backups: Ensure your database backups actually ran.
- Background Jobs: Monitor workers, import scripts, or periodic tasks.
- Intranet Devices: Monitor devices behind a firewall that can send outbound requests.
How it works
- You create a Heartbeat Monitor in the dashboard.
- We give you a unique Heartbeat URL.
- You configure your script (Cronjob, Worker) to call this URL when it finishes successfully.
- We expect a ping within your configured Interval (plus a Grace Period).
- If we don't receive a ping in time, we send an alert: "Heartbeat missing".
Configuration
Expected Interval
How often do you expect the ping?
- Example: For a daily backup, set this to 24 hours (1440 minutes).
- Example: For a minutely worker, set this to 1 minute.
Grace Period
How much delay is acceptable?
- Example: If your backup usually takes 10 minutes but sometimes 30, set the Grace Period to 30 minutes.
- We will only alert if
Last Ping Time + Interval + Grace Period < NOW.
Usage Examples
Linux Cronjob (Backup Script)
#!/bin/bash
# Run backup ...
pg_dump dbname > backup.sql
# If successful, ping the heartbeat
if [ $? -eq 0 ]; then
curl -m 10 --retry 3 https://ping.uptimeify.io/ping/YOUR_TOKEN
fi
PowerShell (Windows)
# Run task...
Write-Output "Task running..."
# Ping Heartbeat
Invoke-RestMethod -Uri "https://ping.uptimeify.io/ping/YOUR_TOKEN"
Node.js Worker
await doImport();
// Ping
await fetch('https://ping.uptimeify.io/ping/YOUR_TOKEN');