Prometheus Exporter for SRCDS game servers, working with CSGO, CSS, GMod, HL2, L4D2 and TF2 !
10K+
docker run -d -p <external port>:9591 --name srcds_exporter --restart=always corentincl/srcds_exporter
You need to have NodeJS installed if you want to run the sources, NVM (Node Version Manager) is a simple tool to get it running : https://github.com/nvm-sh/nvm
npm i, this will install all required dependenciesnode index.js, you can create a service or run it in a screen to keep it active in backgroundBy default, the exporter runs on port 9591, it's possible to customize this by setting the HTTP_PORT variable to the desired port.
Add the following configuration to Prometheus static configuration :
- job_name: 'srcds'
static_configs:
- targets: ["<ip>:<port>:<rconpassword>:<game>"]
relabel_configs:
- source_labels: [__address__]
regex: "(.+):.+:.+:.+"
replacement: "$1"
target_label: __param_ip
- source_labels: [__address__]
regex: ".+:(.+):.+:.+"
replacement: "$1"
target_label: __param_port
- source_labels: [__address__]
regex: ".+:.+:(.+):.+"
replacement: "$1"
target_label: __param_password
- source_labels: [__address__]
regex: ".+:.+:.+:(.+)"
replacement: "$1"
target_label: __param_game
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: <IP>:<port> # Real exporter's IP:Port
Values for game field :
| Game | Value |
|---|---|
| Counter Strike: Global Offensive | csgo |
| Counter Strike: Source | css |
| Garry's Mod | gmod |
| Half Life 2 DM | hl2 |
| Left 4 Dead 2 | l4d2 |
| Team Fortress 2 | tf2 |
If you want to see what the exporter returns, you can access :
http://<ip>:9591/metrics?ip=<srcds ip>&port=<srcds port>&password=<rcon password>&game=<game>
Is there a Grafana dashboard available ? Of course! You can have a "global" dashboard with all the servers you want to monitor (status, CPU, netin/out) and a "per server" dashboard with all the metrics you want to monitor (players, users, etc.)
Counter Strike: Global Offensive : https://grafana.com/grafana/dashboards/11333
Counter Strike: Source : Coming
Garry's Mod : Coming
Half Life 2 : Coming
Left 4 Dead 2 : Coming
Team Fortress 2 : Coming
If you encounter any issue, feel free to open an issue. If you want to contact me :
Content type
Image
Digest
sha256:cc305a1f3…
Size
56 MB
Last updated
almost 4 years ago
docker pull corentincl/srcds_exporter