Incident response
Heartbeats
Track cron jobs and scheduled tasks with MonoDuty check-in URLs, grace periods, missed-check alerts, escalation, and check-in history.
Heartbeats
Heartbeats let you track whether your cron jobs, scheduled tasks, background workers, and batch processes are running as expected. Create a monitor, get a unique check-in URL, and we'll alert you the moment a check-in is missed.
How It Works Your task sends an HTTP request (a "ping") to a unique check-in URL at regular intervals. If MonoDuty doesn't receive a ping within the expected interval + grace period, it triggers alerts via your configured notification channels.
Key Features
- Unique Check-in URLs β Each monitor gets a unique URL like
https://api.monoduty.com/pulse/abc123... - Configurable Intervals β Set how often you expect check-ins (minimum 60 seconds)
- Grace Periods β Allow a buffer before alerting (e.g., 60 seconds grace)
- Multi-Channel Alerts β Email, SMS, Voice Call, Slack, Discord, Push Notification
- Escalation Support β Configure delay-based escalation to different channels
- Pause & Resume β Temporarily disable monitoring during maintenance windows
- Check-in History β View the last 20 check-in logs with timestamps
Creating a Heartbeat
Via Dashboard
- Navigate to Dashboard β Heartbeats
- Click "New Monitor"
- Enter a name (e.g., "Nightly DB Backup")
- Set the check-in interval (how often the task runs, e.g., every 300 seconds / 5 minutes)
- Set a grace period (extra buffer before alerting, e.g., 60 seconds)
- Configure notification channels (Email, SMS, Voice, Slack, etc.)
- Click "Create" to get your unique check-in URL
Via API
curl -X POST https://api.monoduty.com/api/pulse-monitors \
-H "Content-Type: application/json" \
-d '{
"name": "Nightly DB Backup",
"interval_seconds": 86400,
"grace_seconds": 300,
"channels": [
{"type": "EMAIL"},
{"type": "SMS", "target": "+1234567890", "delayMinutes": 5}
]
}'β
Response includes your check-in URL After creation, you'll receive a
checkin_url like https://api.monoduty.com/pulse/abc123def456.... Use this URL in your tasks. Integrating Check-ins
Send a simple HTTP request to your check-in URL from your cron job or scheduled task. Any HTTP method works (GET, POST, HEAD).
Cron Job Example
# Add to the end of your cron job script */5 * * * * /path/to/your/script.sh && curl -fsS --retry 3 https://api.monoduty.com/pulse/YOUR_TOKEN
Python Example
import requests
def my_scheduled_task():
# ... your task logic here ...
# Ping MonoDuty on success
requests.get("https://api.monoduty.com/pulse/YOUR_TOKEN", timeout=10)Node.js Example
const https = require('https');
async function myTask() {
// ... your task logic ...
// Ping MonoDuty on completion
https.get('https://api.monoduty.com/pulse/YOUR_TOKEN');
}Docker / Kubernetes CronJob
# Kubernetes CronJob example
apiVersion: batch/v1
kind: CronJob
metadata:
name: db-backup
spec:
schedule: "0 2 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: backup
image: my-backup:latest
command:
- /bin/sh
- -c
- "/backup.sh && curl -fsS https://api.monoduty.com/pulse/YOUR_TOKEN"Best Practice Place the check-in ping at the end of your task so it only fires on successful completion. Use
&& in shell scripts to chain it after your main command. Alert Configuration
Heartbeats support the same notification channels as webhooks:
| Channel | Description | Escalation |
|---|---|---|
EMAIL | Alert sent to your account email | Immediate or delayed |
SMS | Text message to configured number | Delayed escalation supported |
CALL | Automated voice call for critical alerts | Delayed escalation supported |
SLACK | Message to Slack channel via webhook URL | Immediate or delayed |
DISCORD | Message to Discord channel | Immediate or delayed |
PUSH_NOTIF | Mobile push notification | Immediate |
Escalation Example
You can configure multi-tier escalation. For example: send an Email immediately, then SMS after 5 minutes if still unresolved, then Voice Call after 10 minutes:
{
"channels": [
{"type": "EMAIL", "delayMinutes": 0},
{"type": "SMS", "target": "+1234567890", "delayMinutes": 5},
{"type": "CALL", "target": "+1234567890", "delayMinutes": 10}
]
}Alert Limits To prevent alert fatigue, Heartbeats will send up to 5 alerts per incident before pausing. Alerts resume on the next successful check-in.