Heartbeat Monitoring
Get notified when your services stop responding.
How it works
Heartbeat monitoring ensures your critical services are running. Your service sends periodic "pings" to Talarius. If a ping is missed, you get an alert.
Set interval
Tell Talarius how often to expect pings (1-60 minutes).
Send pings
Your service sends POST requests at the specified interval.
Get alerted
If a ping is missed, Talarius alerts your destination.
Heartbeat states
Each heartbeat has a state that transitions based on ping activity:
| State | Description | Alert? |
|---|---|---|
| new | Initial state, waiting for first ping | No |
| healthy | Pings received on schedule | No |
| grace | Ping overdue but within grace period | No |
| failing | Ping missed, service appears down | Yes |
Grace period
The grace period is equal to your configured interval. A 5-minute interval means 5 minutes of grace.
Quick start
Send a POST request to /heartbeats with your expected interval:
curl -X POST https://v1.talarius.io/heartbeats \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"interval": 5}'The interval parameter tells Talarius how often to expect pings (in minutes).
Integration examples
Cron job (Linux/macOS)
# Run every 5 minutes
*/5 * * * * curl -X POST https://v1.talarius.io/heartbeats \
-H "X-API-Key: $TALARIUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"interval": 5}'Node.js
// Send heartbeat every 5 minutes
setInterval(async () => {
try {
await fetch('https://v1.talarius.io/heartbeats', {
method: 'POST',
headers: {
'X-API-Key': process.env.TALARIUS_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({ interval: 5 }),
});
} catch (error) {
console.error('Heartbeat failed:', error);
}
}, 5 * 60 * 1000);Python
import schedule
import requests
import os
def send_heartbeat():
requests.post(
'https://v1.talarius.io/heartbeats',
headers={
'X-API-Key': os.environ['TALARIUS_API_KEY'],
'Content-Type': 'application/json',
},
json={'interval': 5},
)
schedule.every(5).minutes.do(send_heartbeat)
while True:
schedule.run_pending()
time.sleep(1)Best practices
Choose appropriate intervals
Match the interval to how quickly you need to know about failures. Critical services might use 1-5 minutes, less critical services 15-30 minutes.
Handle failures gracefully
If the heartbeat request fails, log it but don't crash your application. Network issues happen.
Use separate projects
Create separate Talarius projects for different services so you know exactly which one failed.