itzg / mc-monitor

Monitor the status of Minecraft servers and provides Prometheus exporter and Influx line protocol output
MIT License
222 stars 29 forks source link

[Enhancement] Add more data obtained through rcon #89

Open Minecraftschurli opened 2 weeks ago

Minecraftschurli commented 2 weeks ago

Currently this tool relies solely on querying the server to provide stats. My idea is to add functionality to obtain additional metrics when rcon access is available. Although this would require either configuration or detection of the server brand and version to know what commands to use this could be useful for having tps and mspt stats.

itzg commented 2 weeks ago

Thanks, this is an interesting enhancement idea.

...however, RCON responds with unstructured text and worse still doesn't even include newline delimiters.

I'll have to give this some more thought, but off hand I'm not comfortable with introducing RCON here since the design of mc-monitor is focused on the official structured protocol responses.

I would prefer to see a separate tool introduced that uses rcon and is extensible in a way that it knows how to parse the text responses for the respective commands, and export those accordingly.

Minecraftschurli commented 2 weeks ago

Looking at the code NeoForge and Forge have a fix in place for the missing newlines and looking at another prometheus data provider for minecraft it can be retrieved via the tps command (/forge tps / /neoforge tps) and parsed via regex (see: https://github.com/dirien/minecraft-prometheus-exporter/blob/main/pkg/exporter/exporter.go#L160)

itzg commented 2 weeks ago

Thanks for the extra info -- that's really good to know.

I was going to say, another tool probably provides what you need. Why not just use that?

Minecraftschurli commented 2 weeks ago

the problem is that those tools are all currently missing neoforge support and expose way more metrics than I need which could put strain on the server always running the commands