Overview
The scheduler:- Executes monitors based on their interval or cron schedule
- Evaluates alert conditions and fires/resolves alerts
- Dispatches webhooks to notification channels with exponential backoff retry
- Provides an HTTP API for health checks and manual triggers
- Supports multi-region deployments
Running the Scheduler
Standalone Process
Start the scheduler in a separate terminal from your main application:- Connect to your database (using
DATABASE_URL) - Load all monitor configurations from
pongo/monitors/ - Start the HTTP API server (default port 3001)
- Begin executing monitors according to their schedules
Docker
The Docker entrypoint can auto-start the scheduler:docker-compose.yml
Fly.io
The includedfly.toml and Dockerfile handle scheduler deployment:
HTTP API
The scheduler exposes an HTTP API for monitoring and control.Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check with region info and uptime |
/monitors | GET | List all monitors with current state |
/monitors/:id | GET | Get single monitor state and statistics |
/monitors/:id/trigger | POST | Trigger a specific monitor immediately |
/monitors/trigger | POST | Trigger all monitors immediately |
Health Check Example
Manual Trigger Example
Environment Variables
Core Configuration
HTTP API server port.
Auto-start scheduler in Docker entrypoint.
Scheduler service URL. Set this in your main app to enable manual monitor runs from the dashboard UI.
Show manual run button in dashboard UI. Requires
SCHEDULER_URL to be set.Concurrency and Performance
Maximum number of monitors to execute in parallel.Increase for large monitor fleets:
Retry Configuration
Number of retry attempts for failed monitor checks.
Base retry delay in milliseconds. Uses exponential backoff:
- Attempt 1:
SCHEDULER_RETRY_DELAY_MS - Attempt 2:
SCHEDULER_RETRY_DELAY_MS * 2 - Attempt 3:
SCHEDULER_RETRY_DELAY_MS * 4
Multi-Region Setup
Deploy multiple scheduler instances across regions for global monitoring:Region Identifier
Region identifier for multi-region deployments. Used in:
- Alert region thresholds (
regionThresholdin monitor config) - Health check responses
- Check result metadata
Region-Aware Alerts
Configure alerts to fire based on regional thresholds:"any"- Alert fires if any region meets condition"all"- Alert fires only if all regions meet condition"majority"- Alert fires if majority of regions meet conditionnumber- Alert fires if at least N regions meet condition
Complete Configuration Example
Development (Single Region)
.env
Production (Multi-Region)
.env.us-east
.env.eu-west
Docker Compose (Single Region)
docker-compose.yml
Monitoring the Scheduler
Health Checks
Regularly check scheduler health:docker-compose.yml
Monitor State
Check individual monitor state:Troubleshooting
Scheduler Won’t Start
-
Database Connection: Verify
DATABASE_URLis correct -
Port Conflict: Ensure port 3001 (or your custom
SCHEDULER_PORT) is available -
Monitor Configuration: Check for syntax errors in
pongo/monitors/
Monitors Not Running
- Check Monitor Registration: Ensure monitors are exported in
pongo/monitors/index.ts - Verify Schedule: Check monitor
intervalor cron expression syntax - Review Logs: Look for execution errors in scheduler output
High Latency
- Increase Concurrency: Raise
SCHEDULER_MAX_CONCURRENCYif you have many monitors - Database Performance: Check database connection pool and query performance
- Monitor Timeouts: Ensure monitor
timeoutvalues are appropriate
Failed Checks
- Network Access: Verify scheduler can reach monitored endpoints
- Retry Configuration: Adjust
SCHEDULER_MAX_RETRIESandSCHEDULER_RETRY_DELAY_MS - Monitor Handler Errors: Review monitor handler code for bugs
Database Sharing: All scheduler instances must share the same database. This ensures consistent state across regions.