Skip to main content

Prometheus Metrics

O.D.I.N. exposes a Prometheus-compatible /api/v1/metrics endpoint (alias /api/metrics). 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). Scrape it with an API token that has the read:analytics scope.

GET /api/metrics

Available Metrics​

Metric names verified from the O.D.I.N. source:

Metric NameTypeDescription
odin_printers_totalGaugeTotal registered active printers
odin_printers_onlineGaugePrinters seen in the last 90 seconds
odin_printers_printingGaugePrinters currently in RUNNING or PREPARE state
odin_printers_idleGaugeOnline printers with no active job
odin_printers_errorGaugeOnline printers in FAILED or UNKNOWN state
odin_printer_nozzle_temp_celsiusGaugeCurrent nozzle temperature per printer (labels: printer, printer_id)
odin_printer_bed_temp_celsiusGaugeCurrent bed temperature per printer
odin_printer_progressGaugePrint progress 0–100 per printer
odin_printer_print_hours_totalCounterLifetime print hours per printer
odin_printer_print_count_totalCounterLifetime print count per printer
odin_jobs_by_statusGaugeJob count per status (label: status)
odin_queue_depthGaugeJobs in pending, scheduled, or submitted state
odin_spools_totalGaugeTotal tracked spools with weight data
odin_spools_lowGaugeSpools with less than 100g remaining
odin_orders_by_statusGaugeOrder count per status (label: status)
odin_alerts_unreadGaugeTotal unread alerts
odin_database_upGaugeDatabase answered this scrape's queries (1 = up)
odin_build_infoGaugeBuild information (label: version)
odin_process_uptime_secondsGaugeAPI process uptime

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'
15-Second Scrape Interval Recommended

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​

  1. In Grafana, go to Configuration → Data Sources → Add data source
  2. Select Prometheus
  3. Set the URL to your Prometheus instance (e.g., http://prometheus:9090)
  4. Click Save & Test

Example Panels​

Fleet Status (Stat panels):

  • odin_printers_online — Online Printers
  • odin_printers_printing — Currently Printing
  • odin_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​