This tool is meant to be deployed alongside a single Factorio server to provide a simple, stateless status page and a Prometheus /metrics
endpoint that can be used for monitoring and alerting around game-specific details.
Since this relies entirely on Factorio RCON commands to pull data, there's no need for client-side or server-side mods but it does mean we're extremely limited in what we can scrape. For a more in depth approach to in-game monitoring via Prometheus, you should look at celestialorb's Factorio Prometheus Exporter.
- Hardware stats (CPU, RAM usage) should come from a separate exporter like node_exporter or cAdvisor. It doesn't make sense to integrate them within this project.
- Monitoring more than one server with a single instance of this utility is out out-of-scope as the use case isn't obvious and it doesn't seem worthwhile to support things like asyncronous scraping with purposefully small resource footprint.
- We don't have any built-in mechanisms to setup HTTPS on the status page because we don't want to make any assumptions about your certificate and/or proxy setup. In the future, it might make sense to add a basic certificate request for a single provide like Cloudflare for demo purposes.
Regardless of how install and run the exporter, you'll need to:
- Have a Factorio server running with it's RCON endpoint available.
- Download or clone this repo.
- Copy the
.env-sample
file and enter your Factorio server's info:$ cp .env-sample .env $ nano .env
If you want to run the exporter and status page without Docker, you can do so if you've got Python 3.8 or greater already installed (python3 --version
)
- Clone the repo and
cd
into the project directory. - Setup your virtual environment:
$ python3 -m venv venv # Linux venv activation: $ source venv/bin/activate (venv) $
- Install dependencies:
(venv) $ pip install -r requirements.txt
- Run the utility:
(venv) $ python3 factorio-status.py
Wherever you're running your Prometheus instance, edit it's prometheus.yml
config file to add a job for our exporter by adding a new scrape_config
block with the appropriate exporter endpoint info and scrape interval.
If you adjusted the SCRAPE_INTERVAL_S
variable from the default 15 seconds in the .env
file that sets the interval that the exporter checks in with the game server, you'll want to adjust this scrape interval to match.
prometheus.yml
scrape_configs:
- job_name: "factorio-exporter"
static_configs:
- targets: ["localhost:9042"]
scrape_interval: 15s
After editing the prometheus.yml
file, reload the Prometheus config to apply the changes. This can usually be done by sending a SIGHUP signal to the Prometheus process if it's been configured to allow it:
$ curl -X POST prometheus.example.com:9090/-/reload