Bot Heartbeat
Monitor your bot's uptime and health status by sending regular heartbeat signals to cThrone.
Uptime Monitoring
cThrone tracks when your bot is active. If no heartbeat is received for a few minutes, the bot is marked as "down" in your dashboard.
Frequency
Send a heartbeat request once every minute. We enforce a rate limit of 1 request per 30 seconds per IP address.
Uptime SLA
Heartbeat uptime is computed per day using SLA-style availability. We measure how long your bot was reachable within the observed window and convert that into a percentage.
Status Thresholds
- Healthy: uptime ≥ 99.9%
- Degraded: uptime ≥ 95% and < 99.9%
- Down: uptime < 95%
- Missing: no heartbeat events for the day
How Uptime Is Calculated
- Uptime % = 1 - (downtimeSeconds / observedSeconds) for the day.
- A downtime gap is detected when a heartbeat is missing for more than 3× the average interval.
- The first measurement day starts at the first heartbeat event, so time before the first ping is not counted as downtime.
- Days before the first recorded heartbeat are excluded from statistics.
Implementation
To enable heartbeat monitoring, send a POST request to the heartbeat endpoint from your bot's process.
POSThttps://your-bot-key.cthrone.dev/api/v1/heartbeat
cURL
curl -X POST https://your-bot-key.cthrone.dev/api/v1/heartbeat \
-H "Authorization: Bearer YOUR_BOT_TOKEN"Node.js (Axios)
const axios = require('axios');
// Run this interval in your bot process
setInterval(async () => {
try {
await axios.post('https://your-bot-key.cthrone.dev/api/v1/heartbeat', {}, {
headers: {
'Authorization': `Bearer ${process.env.BOT_TOKEN}`
}
});
} catch (error) {
console.error('Heartbeat failed:', error.message);
}
}, 60 * 1000); // Every 60 secondsPython (Requests)
import requests
import time
import threading
def send_heartbeat():
while True:
try:
requests.post(
'https://your-bot-key.cthrone.dev/api/v1/heartbeat',
headers={'Authorization': 'Bearer YOUR_BOT_TOKEN'}
)
except Exception as e:
print(f"Heartbeat failed: {e}")
time.sleep(60) # Every 60 seconds
# Start in a background thread
threading.Thread(target=send_heartbeat, daemon=True).start()Important Note
Ensure you replace your-bot-key with your actual Bot URL Key and YOUR_BOT_TOKEN with your bot's platform token.
