Prometheus Metrics
O.D.I.N. exposes a Prometheus-compatible /metrics endpoint. Scrape it with Prometheus and build Grafana dashboards for fleet telemetry, job throughput, and spool inventory.
Overview
The metrics endpoint returns all metrics in the standard Prometheus text exposition format (text/plain, version 0.0.4). A viewer role or API key is required.
GET /api/metrics
Available Metrics
Metric names verified from the O.D.I.N. source:
| Metric Name | Type | Description |
|---|---|---|
odin_printers_total | Gauge | Total registered active printers |
odin_printers_online | Gauge | Printers seen in the last 90 seconds |
odin_printers_printing | Gauge | Printers currently in RUNNING or PREPARE state |
odin_printers_idle | Gauge | Online printers with no active job |
odin_printers_error | Gauge | Online printers in FAILED or UNKNOWN state |
odin_printer_nozzle_temp_celsius | Gauge | Current nozzle temperature per printer (labels: printer, printer_id) |
odin_printer_bed_temp_celsius | Gauge | Current bed temperature per printer |
odin_printer_progress | Gauge | Print progress 0–100 per printer |
odin_printer_print_hours_total | Counter | Lifetime print hours per printer |
odin_printer_print_count_total | Counter | Lifetime print count per printer |
odin_jobs_by_status | Gauge | Job count per status (label: status) |
odin_queue_depth | Gauge | Jobs in pending, scheduled, or submitted state |
odin_spools_total | Gauge | Total tracked spools with weight data |
odin_spools_low | Gauge | Spools with less than 100g remaining |
odin_orders_by_status | Gauge | Order count per status (label: status) |
odin_alerts_unread | Gauge | Total unread alerts |
Per-printer metrics include printer (name) and printer_id labels for filtering.
Prometheus Configuration
Add O.D.I.N. as a scrape target in your prometheus.yml:
scrape_configs:
- job_name: 'odin'
scrape_interval: 15s
static_configs:
- targets: ['your-odin-host:8000']
metrics_path: '/api/metrics'
# If using API key authentication:
authorization:
type: Bearer
credentials: 'your-scoped-api-token'
# Or use basic auth:
# basic_auth:
# username: 'admin'
# password: 'your-password'
The default O.D.I.N. telemetry update rate is approximately 15–30 seconds depending on the printer protocol. Scraping more frequently than 15s will not yield faster data; it only increases load on the SQLite database. A 15-second interval is the recommended minimum.
Grafana Dashboard Setup
Add Prometheus Data Source
- In Grafana, go to Configuration → Data Sources → Add data source
- Select Prometheus
- Set the URL to your Prometheus instance (e.g.,
http://prometheus:9090) - Click Save & Test
Example Panels
Fleet Status (Stat panels):
odin_printers_online— Online Printersodin_printers_printing— Currently Printingodin_queue_depth— Queue Depth
Per-Printer Temperature Graph:
odin_printer_nozzle_temp_celsius
Use the printer label to split by printer.
Job Completion Rate:
rate(odin_printer_print_count_total[1h])
Low Spool Alert:
odin_spools_low > 0
See Also
- Analytics & Reporting — built-in analytics without Prometheus
- Smart Plug Control — energy data source for analytics