[GH-ISSUE #3003] telegraf input support #2139

Closed
opened 2026-02-27 03:01:05 +03:00 by kerem · 14 comments
Owner

Originally created by @mspencerl87 on GitHub (Aug 14, 2020).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/3003

User Story

Is there anyway to export ./gameserver monitor metics to grafana?
Or is there anyway to export metrics, server stats, uptime, players, ports etc, to telegraf?

Basic info

  • Distro: [Ubuntu 20.04]
  • Game: Any Game
  • Command: [Monitor] export telegraf
  • LinuxGSM version: [v20.1.3]

Further Information

Would like to monitor servers status remotely, currently the only thing I can think to monitor is systemd
but this will mostly only show CPU/Memory usage

Further Reading

As an example, i run docker. I can export the docker hosts metrics via telegraf and display them in grafana like the link below.
It would be awesome to be able to do this with LinuxGSM
https://grafana.com/grafana/dashboards/10585
Another example
https://github.com/ratibor78/srvstatus

Originally created by @mspencerl87 on GitHub (Aug 14, 2020). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/3003 ## User Story Is there anyway to export ./gameserver monitor metics to grafana? Or is there anyway to export metrics, server stats, uptime, players, ports etc, to telegraf? ## Basic info * **Distro:** [Ubuntu 20.04] * **Game:** Any Game * **Command:** [Monitor] export telegraf * **LinuxGSM version:** [v20.1.3] ## Further Information Would like to monitor servers status remotely, **currently the only thing I can think to monitor is systemd but this will mostly only show CPU/Memory usage** ## Further Reading As an example, i run docker. I can export the docker hosts metrics via telegraf and display them in grafana like the link below. It would be awesome to be able to do this with LinuxGSM https://grafana.com/grafana/dashboards/10585 Another example https://github.com/ratibor78/srvstatus
kerem 2026-02-27 03:01:05 +03:00
Author
Owner

@issue-label-bot[bot] commented on GitHub (Aug 14, 2020):

Issue-Label Bot is automatically applying the label type: feature request to this issue, with a confidence of 0.90. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

<!-- gh-comment-id:674050009 --> @issue-label-bot[bot] commented on GitHub (Aug 14, 2020): Issue-Label Bot is automatically applying the label `type: feature request` to this issue, with a confidence of 0.90. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback! Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/GameServerManagers/LinuxGSM) and [code](https://github.com/hamelsmu/MLapp) for this bot.
Author
Owner

@dgibbs64 commented on GitHub (Aug 14, 2020):

If there is an API in a similar vein to discord telegram etc then it would be possible. Of you can post any docs about sending messages via an API then I can take a look :)

<!-- gh-comment-id:674052021 --> @dgibbs64 commented on GitHub (Aug 14, 2020): If there is an API in a similar vein to discord telegram etc then it would be possible. Of you can post any docs about sending messages via an API then I can take a look :)
Author
Owner

@mspencerl87 commented on GitHub (Aug 14, 2020):

@dgibbs64 Are you familiar with Telegraf?
Here is the github page
https://github.com/telegraf/telegraf
https://github.com/influxdata/telegraf
https://www.influxdata.com/time-series-platform/telegraf/

GitHub
Modern Telegram Bot Framework for Node.js. Contribute to telegraf/telegraf development by creating an account on GitHub.
GitHub
The plugin-driven server agent for collecting & reporting metrics. - influxdata/telegraf
<!-- gh-comment-id:674052997 --> @mspencerl87 commented on GitHub (Aug 14, 2020): @dgibbs64 Are you familiar with Telegraf? Here is the github page https://github.com/telegraf/telegraf https://github.com/influxdata/telegraf https://www.influxdata.com/time-series-platform/telegraf/ <blockquote><img src="https://repository-images.githubusercontent.com/56398352/e9853c00-f000-11e9-8687-13f2d4fdb301" width="48" align="right"><div><img src="https://github.githubassets.com/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/telegraf/telegraf">telegraf/telegraf</a></strong></div><div>Modern Telegram Bot Framework for Node.js. Contribute to telegraf/telegraf development by creating an account on GitHub.</div></blockquote> <blockquote><img src="https://avatars2.githubusercontent.com/u/5713248?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/influxdata/telegraf">influxdata/telegraf</a></strong></div><div>The plugin-driven server agent for collecting & reporting metrics. - influxdata/telegraf</div></blockquote>
Author
Owner

@mspencerl87 commented on GitHub (Aug 14, 2020):

@dgibbs64 Generally people have been using Grafana to display metrics over the last few years.
These setups generally include the following. Grafana (Visiual) + Influxdb + Telegraf (Metrics Collector)

Telegraf can work in a push or pull configuration, alot of people use telegraf on Linux/Windows systems also SNMP, IPMI etc.
To pull metrics

You can see all the out of the box supported inputs here
https://github.com/influxdata/telegraf/tree/master/plugins/inputs

GitHub
The plugin-driven server agent for collecting & reporting metrics. - influxdata/telegraf
<!-- gh-comment-id:674054610 --> @mspencerl87 commented on GitHub (Aug 14, 2020): @dgibbs64 Generally people have been using Grafana to display metrics over the last few years. These setups generally include the following. Grafana (Visiual) + Influxdb + Telegraf (Metrics Collector) Telegraf can work in a push or pull configuration, alot of people use telegraf on Linux/Windows systems also SNMP, IPMI etc. To pull metrics You can see all the out of the box supported inputs here https://github.com/influxdata/telegraf/tree/master/plugins/inputs <blockquote><img src="https://avatars2.githubusercontent.com/u/5713248?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/influxdata/telegraf">influxdata/telegraf</a></strong></div><div>The plugin-driven server agent for collecting & reporting metrics. - influxdata/telegraf</div></blockquote>
Author
Owner

@dgibbs64 commented on GitHub (Aug 14, 2020):

I am aware of it but never the used it myself. If I can send stuff to an API endpoint/webhook via curl then It's pretty easy for me to setup. But don't know if that's possible here. Check out alert_discord.sh in my code for an example of what I mean.

<!-- gh-comment-id:674055325 --> @dgibbs64 commented on GitHub (Aug 14, 2020): I am aware of it but never the used it myself. If I can send stuff to an API endpoint/webhook via curl then It's pretty easy for me to setup. But don't know if that's possible here. Check out alert_discord.sh in my code for an example of what I mean.
Author
Owner

@mspencerl87 commented on GitHub (Aug 14, 2020):

not finding alert_discord.sh in code. Can you share a link?
And thank you for the consideration.

<!-- gh-comment-id:674058595 --> @mspencerl87 commented on GitHub (Aug 14, 2020): not finding alert_discord.sh in code. Can you share a link? And thank you for the consideration.
Author
Owner

@mspencerl87 commented on GitHub (Aug 14, 2020):

This might be a better example
https://github.com/anderssonoscar0/influxdb_srcds_exporter
This guy is exporting SRCDS to influxdB
This is only on CSGO, but may serve you better.

I wish i could be more help!

GitHub
InfluxDB Exporter for SRCDS game servers, currently working with CSGO - anderssonoscar0/influxdb_srcds_exporter
<!-- gh-comment-id:674065736 --> @mspencerl87 commented on GitHub (Aug 14, 2020): This might be a better example https://github.com/anderssonoscar0/influxdb_srcds_exporter This guy is exporting SRCDS to influxdB This is only on CSGO, but may serve you better. I wish i could be more help! <blockquote><img src="https://avatars1.githubusercontent.com/u/13179116?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/anderssonoscar0/influxdb_srcds_exporter">anderssonoscar0/influxdb_srcds_exporter</a></strong></div><div>InfluxDB Exporter for SRCDS game servers, currently working with CSGO - anderssonoscar0/influxdb_srcds_exporter</div></blockquote>
Author
Owner

@DrPsychick commented on GitHub (Sep 1, 2020):

I've used telegraf quite a bit, maybe I can be of help. I would also be interested in exposing useful stats to telegraf/influxdb.

What to measure/export

First we probably need to find out what data is available. I'm running ARK with LGSM and the monitor command doesn't return anything useful except the number of players online. So if that is easy to get (without installing gamedig as this enlarges my docker image by 300%), I'm happy to provide a small command that can expose it as telegraf metrics.

The second question that comes to mind is: what common metrics are available for all servers? Ideally one could have a command that works for all servers to get version, players online etc.

@dgibbs64 I'm not so familiar with the Query or RCON port. I tried using rcon (which is fast and small), but it no longer works for my ARK server. I've seen code in LGSM (gsquery) which seems obsolete. gamedig is too large for me as it requires installing nodejs. Is there an easier way to get status from the Query port?

<!-- gh-comment-id:684969533 --> @DrPsychick commented on GitHub (Sep 1, 2020): I've used telegraf quite a bit, maybe I can be of help. I would also be interested in exposing useful stats to telegraf/influxdb. ### What to measure/export First we probably need to find out what data is available. I'm running ARK with LGSM and the monitor command doesn't return anything useful except the number of players online. So if that is easy to get (without installing `gamedig` as this enlarges my docker image by 300%), I'm happy to provide a small command that can expose it as telegraf metrics. The second question that comes to mind is: what common metrics are available for all servers? Ideally one could have a command that works for all servers to get version, players online etc. @dgibbs64 I'm not so familiar with the Query or RCON port. I tried using rcon (which is fast and small), but it no longer works for my ARK server. I've seen code in LGSM (gsquery) which seems obsolete. `gamedig` is too large for me as it requires installing nodejs. Is there an easier way to get status from the Query port?
Author
Owner

@dgibbs64 commented on GitHub (Sep 1, 2020):

gamedig is by far the best way to get info useful from game servers. Since game servers can be very large im not sure why increasing the size of a container and installing nodejs matters. gsquery is not obsolete and is used if gamedig is not installed, but gsquery only used to check if query is responding and not gather stats.

The main metric is player numbers and if the server is online.

<!-- gh-comment-id:684976109 --> @dgibbs64 commented on GitHub (Sep 1, 2020): gamedig is by far the best way to get info useful from game servers. Since game servers can be very large im not sure why increasing the size of a container and installing nodejs matters. gsquery is not obsolete and is used if gamedig is not installed, but gsquery only used to check if query is responding and not gather stats. The main metric is player numbers and if the server is online.
Author
Owner

@DrPsychick commented on GitHub (Sep 1, 2020):

if number of players is the only "common" metric (and if the server is online), then I'd prefer a lightweight solution.

One can easily extend my docker image or install gamedig on the host and then create a small script to fetch the result from the log.

BUT I've figured out whats wrong with RCON, so I will fix that and use it to export online players to telegraf.

<!-- gh-comment-id:685057334 --> @DrPsychick commented on GitHub (Sep 1, 2020): if number of players is the only "common" metric (and if the server is online), then I'd prefer a lightweight solution. One can easily extend my docker image or install `gamedig` on the host and then create a small script to fetch the result from the log. BUT I've figured out whats wrong with RCON, so I will fix that and use it to export online players to telegraf.
Author
Owner

@DrPsychick commented on GitHub (Sep 1, 2020):

@dgibbs64 most of what's inside the "details" result that you posted can directly fetched from the system (cpu, mem, disk, ...) so the only interesting metric (for me) so far is the number of players online. Maybe along with the server name/map/type.

<!-- gh-comment-id:685058081 --> @DrPsychick commented on GitHub (Sep 1, 2020): @dgibbs64 most of what's inside the "details" result that you posted can directly fetched from the system (cpu, mem, disk, ...) so the only interesting metric (for me) so far is the number of players online. Maybe along with the server name/map/type.
Author
Owner

@DrPsychick commented on GitHub (Sep 5, 2020):

So, with the fixed RCON script, I can now read the number of online players

python3 rcon-ark.py listplayers | grep -v 'No Players Connected' | wc -l
(see https://github.com/DrPsychick/docker-linuxgsm-ark)

it would indeed be great if LGSM could provide the metric generically with a command as not all games work the same. And gamedig seems to be able to provide the data, right? The only requirement would be that the command executes (or fails) fast and returns machine readable output.

> myserver status
status: online
players: 5
max_players: 10

to use that with telegraf would then be easy with a script that returns influx protocol and is executed with inputs.exec in the telegraf.conf:

#!/bin/bash
stat=$(myserver status)
online=0
if [ -n "$(echo "$stat" | grep 'status: online')" ]; then
  online=1
fi
players=$(echo "$stat" | grep ^players | cut -d: -f2)
max=$(echo "$stat" | grep ^max_players | cut -d: -f2)

echo "players,host=myhost,game=mygame online=$online,players=$players,max_players=$max $(date +%s)000000000"
GitHub
LinuxGSM + Steam ARK server base (shared image for ARK servers) - DrPsychick/docker-linuxgsm-ark
<!-- gh-comment-id:687660269 --> @DrPsychick commented on GitHub (Sep 5, 2020): So, with the fixed RCON script, I can now read the number of online players `python3 rcon-ark.py listplayers | grep -v 'No Players Connected' | wc -l` (see https://github.com/DrPsychick/docker-linuxgsm-ark) it would indeed be great if LGSM could provide the metric generically with a command as not all games work the same. And `gamedig` seems to be able to provide the data, right? The only requirement would be that the command executes (or fails) fast and returns machine readable output. ``` > myserver status status: online players: 5 max_players: 10 ``` to use that with telegraf would then be easy with a script that returns influx protocol and is executed with `inputs.exec` in the `telegraf.conf`: ``` #!/bin/bash stat=$(myserver status) online=0 if [ -n "$(echo "$stat" | grep 'status: online')" ]; then online=1 fi players=$(echo "$stat" | grep ^players | cut -d: -f2) max=$(echo "$stat" | grep ^max_players | cut -d: -f2) echo "players,host=myhost,game=mygame online=$online,players=$players,max_players=$max $(date +%s)000000000" ``` <blockquote><img src="https://avatars3.githubusercontent.com/u/18177732?s=400&v=4" width="48" align="right"><div><img src="https://github.githubassets.com/favicons/favicon.svg" height="14"> GitHub</div><div><strong><a href="https://github.com/DrPsychick/docker-linuxgsm-ark">DrPsychick/docker-linuxgsm-ark</a></strong></div><div>LinuxGSM + Steam ARK server base (shared image for ARK servers) - DrPsychick/docker-linuxgsm-ark</div></blockquote>
Author
Owner

@dgibbs64 commented on GitHub (Oct 20, 2023):

NO update on this. If there is an api endpoint that can be used to send data like the other alerting systems then it will be worth taking a look. I have no knowledge in telegraf currently so closing for now

<!-- gh-comment-id:1773450468 --> @dgibbs64 commented on GitHub (Oct 20, 2023): NO update on this. If there is an api endpoint that can be used to send data like the other alerting systems then it will be worth taking a look. I have no knowledge in telegraf currently so closing for now
Author
Owner

@github-actions[bot] commented on GitHub (Oct 21, 2024):

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

<!-- gh-comment-id:2425308557 --> @github-actions[bot] commented on GitHub (Oct 21, 2024): This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#2139
No description provided.