Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

factorio-dashboard

Live Grafana dashboard for your Factorio factory.

Factorio mod (Lua) ──writes──▶ script-output/metrics.json
                                      │ (bind mount, read-only)
                              Go exporter ──/metrics──▶ Prometheus ──▶ Grafana

Factorio mods are sandboxed (no network access), so the mod writes a JSON snapshot of factory statistics every 2 seconds; a small Go exporter parses it and serves Prometheus metrics; Grafana renders them. Everything except the mod runs in docker compose.

Targets Factorio 2.0.x (tested against 2.0.73) with a standalone install at /home/leinonen/Downloads/factorio (change FACTORIO_DIR in the Makefile and the bind mount in docker-compose.yml if yours lives elsewhere).

Quick start

make install-mod    # symlinks mod/factorio-metrics into the Factorio mods dir
make up             # builds the exporter, starts exporter + prometheus + grafana

Then start Factorio and load a save (the mod is enabled by default for new installs — check Mods menu if not). Within a few seconds:

What's collected

Per surface: item/fluid production + consumption (all-time totals and per-minute rates), pollution, evolution factor and its components, kill/loss counts per entity, electric network production/consumption in watts plus accumulator charge, logistic + construction bot counts. Per force: current research progress and rockets launched.

The export interval is a runtime mod setting (Settings → Mod settings → Map: "Export interval (ticks)", default 120 = 2 s).

Metrics reference (selection)

Metric Meaning
factorio_up 1 while metrics.json is fresh (game running, unpaused)
factorio_game_tick current game tick; flat while paused
factorio_item_production_per_minute{item,surface} production rate, last minute
factorio_item_production_total{item,surface} all-time production counter
factorio_power_production_watts{network,generator,surface} 5 s average
factorio_accumulator_charge_joules{network,surface} energy stored
factorio_research_progress_ratio{technology} 0–1
factorio_kills_total{entity,surface} kills by your force

Fluids, consumption, science packs, bots, pollution, and evolution follow the same naming pattern; see curl localhost:9184/metrics for the full list.

Troubleshooting

  • factorio_up is 0 — the game is closed, paused (single player pauses in menus), or the mod isn't enabled. cat ~/Downloads/factorio/script-output/metrics.json should update every 2 s while the game runs.
  • No metrics.json at all — check the Mods menu shows "Factorio Metrics Exporter" enabled, and look for factorio-metrics errors in ~/Downloads/factorio/factorio-current.log.
  • New electric networks/accumulators missing — the entity scan refreshes once a minute; wait 60 s.
  • Grafana shows no data — check http://localhost:9090/targets shows the factorio job UP.

Development

make test                          # exporter unit tests
cd exporter && go run . &          # run exporter outside docker
METRICS_FILE=testdata/metrics.json PORT=9184 go run .

About

Live Grafana dashboard for your Factorio factory.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages