Getting Started with SilentCanary
This guide will walk you through setting up your first canary monitoring in under 5 minutes!
1 Create Your First Canary
A canary represents a process, service, or job you want to monitor. Let's create one:
- Click Create Canary in the navigation
- Fill out the form with these details:
Example Configuration:
- Name: "Daily Database Backup"
- Check-in Interval: 1440 minutes (24 hours)
- Grace Period: 30 minutes
- Alert Type: Email
- Tags: database, backup, critical
- SLA Threshold: 99.5%
Pro Tip
Start with longer intervals and shorter grace periods. You can always adjust based on your actual patterns!
2 Get Your Check-in URL
After creating your canary, you'll see a unique check-in URL on your dashboard:
Keep this URL secure! Anyone with this URL can send check-ins for your canary.
3 Add Check-ins to Your Process
Add a simple HTTP request to your process. Here are examples for different scenarios:
Simple GET Request:
curl "https://silentcanary.com/checkin/your-token-here"
POST with Data:
curl -X POST "https://silentcanary.com/checkin/your-token-here" \
-d "status=success" \
-d "message=Backup completed successfully"
Complete Backup Script Example:
#!/bin/bash
# database-backup.sh
CANARY_URL="https://silentcanary.com/checkin/your-token-here"
BACKUP_DIR="/backups/database"
DATE=$(date +%Y%m%d_%H%M%S)
echo "Starting database backup..."
# Your backup commands here
pg_dump -h localhost -U postgres mydb > "$BACKUP_DIR/backup_$DATE.sql"
# Check if backup was successful
if [ $? -eq 0 ]; then
echo "Backup completed successfully"
# Notify SilentCanary of success
curl -X POST "$CANARY_URL" \
-d "status=success" \
-d "message=Database backup completed at $DATE"
else
echo "Backup failed!"
# You could optionally notify of failure too
curl -X POST "$CANARY_URL" \
-d "status=failed" \
-d "message=Database backup failed at $DATE"
exit 1
fi
Python Script Example:
#!/usr/bin/env python3
import requests
import sys
from datetime import datetime
CANARY_URL = "https://silentcanary.com/checkin/your-token-here"
def notify_silentcanary(status="success", message=""):
"""Send check-in to SilentCanary"""
try:
data = {"status": status, "message": message}
response = requests.post(CANARY_URL, data=data, timeout=10)
if response.status_code == 200:
print(f"✅ SilentCanary notified: {status}")
else:
print(f"❌ SilentCanary notification failed: {response.status_code}")
except Exception as e:
print(f"❌ Error notifying SilentCanary: {e}")
def main():
"""Your main process logic"""
try:
print("Starting data processing...")
# Your actual work here
# process_data()
# generate_reports()
print("Processing completed successfully")
notify_silentcanary("success", f"Data processing completed at {datetime.now()}")
except Exception as e:
print(f"❌ Processing failed: {e}")
notify_silentcanary("failed", f"Data processing failed: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()
Cron Job Examples:
# Edit your crontab with: crontab -e
# Daily backup at 2 AM
0 2 * * * /path/to/backup-script.sh && curl "https://silentcanary.com/checkin/your-token"
# Hourly health check
0 * * * * /path/to/health-check.py && curl -X POST "https://silentcanary.com/checkin/your-token" -d "status=healthy"
# Weekly report generation (Sundays at 6 AM)
0 6 * * 0 /path/to/weekly-report.sh && curl "https://silentcanary.com/checkin/your-token"
# Multiple commands with error handling
*/30 * * * * /path/to/sync-script.sh && curl "https://silentcanary.com/checkin/your-token" || curl -X POST "https://silentcanary.com/checkin/your-token" -d "status=failed"
Tip: The
&&
operator ensures the check-in only happens if your script succeeds!
4 Test Your Setup
Before deploying, test that everything works:
- Manual Test: Run your process manually and verify the check-in appears on your dashboard
- Test Failure: Temporarily disable the check-in and wait for the alert (grace period + interval)
- Verify Notifications: Check that you receive emails/Slack messages
Quick Test Commands:
# Test successful check-in
curl "https://silentcanary.com/checkin/your-token"
# Test with status data
curl -X POST "https://silentcanary.com/checkin/your-token" \
-d "status=testing" \
-d "message=Manual test from terminal"
Success!
If you see "Last Check-in: Just now" on your dashboard, you're all set!
5 Explore Advanced Features
Smart Alerts
Enable ML-powered anomaly detection that learns your patterns and sends smarter alerts.
Learn MoreCommon Gotchas
- Check that your process can reach the internet
- Verify the URL is correct (copy-paste from dashboard)
- Check firewall rules and proxy settings
- Test manually with curl from the same environment
- Increase the grace period to account for normal variations
- Consider using Smart Alerts to reduce false positives
- Review your process timing and adjust interval accordingly
- Check if your process sometimes takes longer than expected
- Use absolute paths in your cron commands
- Set proper environment variables (PATH, etc.)
- Add logging to see what's happening:
yourscript.sh >> /var/log/canary.log 2>&1
- Test your cron syntax with online validators