Grafana Monitoring Example for Orbit
This example demonstrates how to integrate the Orbit scheduler with Prometheus and Grafana for real-time job monitoring and alerting.
π¦ Features
- Tracks job success/failure counts
- Measures execution duration in seconds
- Exposes job status as numeric gauge
- Fully compatible with Prometheus + Grafana stack
π Files
- main.go β Runs an Orbit job that emits Prometheus metrics
π§ Setup Instructions
1. Run the example
go run main.go
It will:
2. Prometheus Configuration
Create a file named prometheus.yml:
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'orbit_example'
static_configs:
- targets: ['localhost:2112']
Then run Prometheus:
prometheus --config.file=prometheus.yml
3. Grafana Dashboard (Suggested Panels)
Import a new dashboard and add these panels:
β
Job Success Count
sum(increase(job_success_total[5m])) by (job_id)
β Job Failure Count
sum(increase(job_failure_total[5m])) by (job_id)
β±οΈ Execution Duration (Histogram)
histogram_quantile(0.95, sum(rate(job_duration_seconds_bucket[5m])) by (le, job_id))
π Job Status
job_status{job_id="grafana_demo_job"}
Display as: Stat panel with value mappings:
0 = Waiting
1 = Running
2 = Completed
3 = Error
4 = Paused
5 = Stopped
π Example Output
After running a few minutes, your dashboard will show:
- Success/failure spikes
- Duration distribution
- Live job state indicator
π‘ Tips
- You can add alert rules in Prometheus for job error spikes
- You can expose additional metrics by extending PrometheusMonitoring
- All metric labels are per job_id to support multi-job environments
Made with β€οΈ and Orbit