(fork of graftorio) factorio mod for creating grafana dashboard
Lua
114
118 commits
updated Aug 5, 2024
Fork of graftorio
visualize metrics from your Factorio game in Grafana

Grafana is an open-source project for rendering time-series metrics.
by using graftorio2, you can create a dashboard with various charts monitoring aspects of your Factorio factory.
this dashboard is viewed using a web browser outside of the game client. (works great in a 2nd monitor!)
in order to use graftorio2, you need to run the Grafana software and a database called Prometheus locally.
graftorio2 automates this process using docker, or you can set these up by hand.
docker-compose.yml in a text editor and uncomment the correct path to your Factorio install
chown -R 472 config/grafanachown -R 65534 config/prometheuschown -R 472 data/grafanachown -R 65534 data/prometheusdocker-compose up inside the extracted directorylocalhost:3000 in a browser, you should login once and set a secure password!
whenever you want to publish your dashboard to the public you can do this by placing this upon a server and opening up the ports for your game.
preferable all runs on the same server, but separating the game and the Grafana dahsboard is possible.
in the following example we'll explain on how to set it up all on 1 server.
when ever you are hosting this on a server it's prefered to run this as the docker instance.
we placed an nginx as reverse proxy in front of it to forward the http(s) requests to the Grafana server.
server {
listen 80;
listen [::]:80;
server_name domain.name;
return 301 https://domain.name$request_uri;
}
server {
location / {
proxy_pass http://127.0.0.1:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl on;
listen [::]:443 ssl;
listen 443 ssl;
# Here we used a letsencrypt cert (stripped out the actual files)
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
change the environment: variable in docker-compose.yml.
for example the domain name and the root URL you're going to use for the public.
this way dashboards can be made visible to the public.
for more details consult the Grafana docker documentation.
for example:
environment:
- GF_SERVER_DOMAIN=domain.name
- GF_SERVER_ROOT_URL=https://%(domain)s/graftorio
- GF_SERVER_SERVE_FROM_SUB_PATH=true # the `/graftorio` part of URL
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_BASIC_ENABLED=false
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
- GF_AUTH_ANONYMOUS_HIDE_VERSION=true
like for Grafana you may want to set some custom propperties for your Prometheus backend.
but for Prometheus you need to set them as command: inside the docker-compose.yml.
for more details consult the Prometheus docker documentation
for example:
command:
- '--storage.tsdb.retention.time=14d'
the exporter needs to have access to your game.prom file, so change the path in the docker-compose.yml to where script-output/graftorio is found.
Separate servers
whenever you want to run the game on a different server you would have to change a few things.
docker-compose.ymlconfig/prometheus/prometheus.yml to let the targets point to your exporters ip:porthowever when you want to separate this all, keep in mind that most of the default settings in this readme/repo are not correct.
so these have to be changed to your needs.
open your http://domain.name and see the login for Grafana. keep in mind that this short guide doesn't explain on how to properly secure everything. this is up to you to fix yourself.
The list of currently included metrics can be found in Metrics.md.
this repository includes a variety of ready to use dashboards.
those dashboards are from Kariton/graftorio2-dashboards.
the dashboards will be updated within this repostory if new versions are available.
all dashboards support a variety of different filters, panel links as well as data links.
for example: Force, TimeScale, Network, Item / Fluid / Building / etc.
player - some mods provide their own identifyer.Minute - is used to calculate values per Second / Minute / Hour.all - depending on context the available networks like electricity / logistic.all - depending on context the available entities.Info - overall statsTimeScale based on last hourItems - important items - delta production / consumptionDefault - rebuild of ingame graphs (as close as possible)Rate - Various interpretation of "rate"Misc - detailed presentation in various formsMod - dashboards dedicated to display mod related informationto see if Factorio is generating stats, confirm a game.prom file exists at the configured exporter volume directory. when opened, it should look something like this:
# HELP factorio_item_production_input items produced
# TYPE factorio_item_production_input gauge
factorio_item_production_input{force="player",name="burner-mining-drill"} 3
factorio_item_production_input{force="player",name="iron-chest"} 1
to see if Prometheus is scraping the data, load localhost:9090/targets in a browser and confirm that the status is "UP".
you should see the target from config/Prometheus/Prometheus.yml.
to see if the Grafana data source can read correctly, there is already a included graftorio2 dashboard.
this should show a linear growing Factorio Tick panel.
alternatively start a new dashboard and add a graph with the query factorio_item_production_input.
the graph should render the total of every item produced in your game.
15 followers · starred Oct 2022
Lua
97.3%
Makefile
2.7%
(fork of graftorio) factorio mod for creating grafana dashboard
Lua
114
118 commits
updated Aug 5, 2024
Fork of graftorio
visualize metrics from your Factorio game in Grafana

Grafana is an open-source project for rendering time-series metrics.
by using graftorio2, you can create a dashboard with various charts monitoring aspects of your Factorio factory.
this dashboard is viewed using a web browser outside of the game client. (works great in a 2nd monitor!)
in order to use graftorio2, you need to run the Grafana software and a database called Prometheus locally.
graftorio2 automates this process using docker, or you can set these up by hand.
docker-compose.yml in a text editor and uncomment the correct path to your Factorio install
chown -R 472 config/grafanachown -R 65534 config/prometheuschown -R 472 data/grafanachown -R 65534 data/prometheusdocker-compose up inside the extracted directorylocalhost:3000 in a browser, you should login once and set a secure password!
whenever you want to publish your dashboard to the public you can do this by placing this upon a server and opening up the ports for your game.
preferable all runs on the same server, but separating the game and the Grafana dahsboard is possible.
in the following example we'll explain on how to set it up all on 1 server.
when ever you are hosting this on a server it's prefered to run this as the docker instance.
we placed an nginx as reverse proxy in front of it to forward the http(s) requests to the Grafana server.
server {
listen 80;
listen [::]:80;
server_name domain.name;
return 301 https://domain.name$request_uri;
}
server {
location / {
proxy_pass http://127.0.0.1:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
ssl on;
listen [::]:443 ssl;
listen 443 ssl;
# Here we used a letsencrypt cert (stripped out the actual files)
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
change the environment: variable in docker-compose.yml.
for example the domain name and the root URL you're going to use for the public.
this way dashboards can be made visible to the public.
for more details consult the Grafana docker documentation.
for example:
environment:
- GF_SERVER_DOMAIN=domain.name
- GF_SERVER_ROOT_URL=https://%(domain)s/graftorio
- GF_SERVER_SERVE_FROM_SUB_PATH=true # the `/graftorio` part of URL
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_BASIC_ENABLED=false
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
- GF_AUTH_ANONYMOUS_HIDE_VERSION=true
like for Grafana you may want to set some custom propperties for your Prometheus backend.
but for Prometheus you need to set them as command: inside the docker-compose.yml.
for more details consult the Prometheus docker documentation
for example:
command:
- '--storage.tsdb.retention.time=14d'
the exporter needs to have access to your game.prom file, so change the path in the docker-compose.yml to where script-output/graftorio is found.
Separate servers
whenever you want to run the game on a different server you would have to change a few things.
docker-compose.ymlconfig/prometheus/prometheus.yml to let the targets point to your exporters ip:porthowever when you want to separate this all, keep in mind that most of the default settings in this readme/repo are not correct.
so these have to be changed to your needs.
open your http://domain.name and see the login for Grafana. keep in mind that this short guide doesn't explain on how to properly secure everything. this is up to you to fix yourself.
The list of currently included metrics can be found in Metrics.md.
this repository includes a variety of ready to use dashboards.
those dashboards are from Kariton/graftorio2-dashboards.
the dashboards will be updated within this repostory if new versions are available.
all dashboards support a variety of different filters, panel links as well as data links.
for example: Force, TimeScale, Network, Item / Fluid / Building / etc.
player - some mods provide their own identifyer.Minute - is used to calculate values per Second / Minute / Hour.all - depending on context the available networks like electricity / logistic.all - depending on context the available entities.Info - overall statsTimeScale based on last hourItems - important items - delta production / consumptionDefault - rebuild of ingame graphs (as close as possible)Rate - Various interpretation of "rate"Misc - detailed presentation in various formsMod - dashboards dedicated to display mod related informationto see if Factorio is generating stats, confirm a game.prom file exists at the configured exporter volume directory. when opened, it should look something like this:
# HELP factorio_item_production_input items produced
# TYPE factorio_item_production_input gauge
factorio_item_production_input{force="player",name="burner-mining-drill"} 3
factorio_item_production_input{force="player",name="iron-chest"} 1
to see if Prometheus is scraping the data, load localhost:9090/targets in a browser and confirm that the status is "UP".
you should see the target from config/Prometheus/Prometheus.yml.
to see if the Grafana data source can read correctly, there is already a included graftorio2 dashboard.
this should show a linear growing Factorio Tick panel.
alternatively start a new dashboard and add a graph with the query factorio_item_production_input.
the graph should render the total of every item produced in your game.
15 followers · starred Oct 2022
Lua
97.3%
Makefile
2.7%