Small Node.js application that provides a Prometheus metric endpoint with data from the ArchiSteamFarm API. The official ASF MonitoringPlugin only supports the generic version of ASF, this will work with any version aslong as you can access its API.
I won't explain how to install and setup anything of the required software. If you don't already have the software, use Google.
- ArchiSteamFarm - Duh...
- Prometheus - This is not a Prometheus tutorial, so I won't go into any details on how to use it. Basic understanding of what Prometheus is and how to use it is required.
- PM2 - PM2 will keep the application running and restart it if it crashes. It is similar to Docker and has its own metrics (if you want to look into these). Maybe in the future I will replace it with a proper Docker container.
- Node.js - Tested with version
23.11.1. I recommend using the latest LTS version.
You have two options:
Clone the repository onto a server using git clone https://github.com/n0eL1405/ASF-Prometheus-Exporter.git. Git is required for this.
Download the repository and store it somewhere on a server.
Generate the config.yaml and .env with npm run setup.
Set all the properties you need.
| Property | Description | Optional |
|---|---|---|
ASF_IPCPASSWORD |
IPC Password for ASF. More information. | ❌ (if you're using one) |
UPTIMEKUMA_KEY |
Key-part of the Push-URL for Uptime Kuma Push-Monitor. More information on Uptime Kuma. | ✅ |
| Property | Description | Optional |
|---|---|---|
app.port |
Port the exporter will use to expose the Prometheus metrics to. | ❌ |
asf.ip |
IP of the server ASF is running on. If the exporter and ASF are running on the same mashine, leave it to 127.0.0.1. |
❌ |
asf.port |
Port ASF is running on. If not sure and/or nothing is changes, leave it to default 1242. If it's not working, see ASF Wiki. |
❌ |
prometheus.prefix |
Prefix for the Prmetheus metrics. Not required but highly recommended, see Prometheus docs. | ✅ |
uptimekuma.ip |
IP of the server Uptime Kuma is running on. If the exporter and Uptime Kuma are running on the same mashine, use 127.0.0.1. More information on Uptime Kuma. |
✅ |
uptimekuma.port |
Port Uptime Kuma is running on. If not sure and/or nothing is changes, leave it to default 3001. More information on Uptime Kuma. |
✅ |
When everything is set up, use npm run start to start the exporter. After the first start, you should be able to start/stop/restart the app using PM2. For more information, see PM2 documentation.
Add a job to your Prometheus config to scrape the exporter. The target should be the IP of the server the exporter is running on and the port you set in the config.
Example:
scrape_configs:
- job_name: 'ASF'
static_configs:
- targets: ['192.168.178.69:6789']Have fun with your ASF metrics!
Updating depends on the selected method to get the app:
If you used git, you can simply run npm run update to pull the latest changes from the repository, install the dependencies and restart the app. There could be some user input required, follow the instructions or use Google if it's Git-related.
If you just downloaded the files, you have to copy and overwrite the files, install the dependencies and restart the app manually. Be careful to not overwrite config.yaml and .env, otherwise you could potentially lose your configuration.
See Prom-CLient and ASF API for references to implement your own metrics.
Except the first metric, every other metric will fetch the information from the ASF API when called.
The data for build_info will be fetched on startup and updates every 10 minutes.
Gives the build variant and version of ASF as label values. See ASF Wiki.
Total number of bots on the ASF instance.
Total number of remaining games to farm.
Total number of cards remaining to farm.
Total number of bots currently farming.
I recommend using Uptime Kuma to monitor the status of the application.
To use Uptime Kuma, create a new Push-Monitor and get the marked Parts from the URL:
'http://192.168.178.69:3001/api/push/sdiDAsdjwASD5Asd5Rad?status=up&msg=OK&ping='
The first and second part are the IP and port of Uptime Kuma.
The third part is the key of the monitor. You set in the .env.
Let everything else as is and you're done! For more information on what to do with Uptime Kuma, see Uptime Kuma docs.
- Use a proper Docker container instead of PM2
- Add (nearly) all metrics from the official ASF MonitoringPlugin
- Implement caching of data from API (e.g. making
Bots/ASFAPI call every 15 seconds and only return the latest fetched data when function is called)