Joshi425 / minecraft-exporter

this is a prometheus minecraft exporter
96 stars 35 forks source link

Metrics not exported on 1.20 #35

Open joshuai96 opened 1 year ago

joshuai96 commented 1 year ago

Some metrics are not exported. I'm using a vanilla Minecraft 1.20.1 server and the exporter in containers. Especially TPS metrics are important to me.

Exporter ENV file:

RCON_HOST=minecraft-server
RCON_PORT=25575
RCON_PASSWORD=****
FORGE_SERVER=False
PAPER_SERVER=False
DYNMAP_ENABLED=False

Server shows RCON connection:

[18:14:57] [RCON Listener #1/INFO]: Thread RCON Client /172.18.0.4 started

Exporter logs:

RCON is enabled for minecraft-server
Successfully connected to RCON
Exporter started on Port 8000

Exporter excerpt:

# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 102.0
python_gc_objects_collected_total{generation="1"} 289.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable object found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 57.0
python_gc_collections_total{generation="1"} 5.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="10",patchlevel="7",version="3.10.7"} 1.0
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 3.0449664e+07
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 2.5112576e+07
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.68702569468e+09
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.79
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 7.0
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP blocks_mined_total Blocks a Player mined
# TYPE blocks_mined_total counter
blocks_mined{block="minecraft:grass",player="Player"} 7.0
blocks_mined{block="minecraft:grass_block",player="Player"} 5.0
blocks_mined{block="minecraft:dirt",player="Player"} 2.0
# HELP blocks_picked_up_total Blocks a Player picked up
# TYPE blocks_picked_up_total counter
blocks_picked_up{block="minecraft:wheat_seeds",player="Player"} 2.0
blocks_picked_up{block="minecraft:dirt",player="Player"} 7.0
# HELP player_deaths_total How often a Player died
# TYPE player_deaths_total counter
player_deaths{player="Player"} 1.0
# HELP player_jumps_total How often a Player has jumped
# TYPE player_jumps_total counter
player_jumps{player="Player"} 37.0
# HELP cm_traveled_total How many cm a Player traveled, whatever that means
# TYPE cm_traveled_total counter
cm_traveled{method="sprinting",player="Player"} 8028.0
cm_traveled{method="walking",player="Player"} 4921.0
cm_traveled{method="swimming",player="Player"} 384.0
cm_traveled{method="diving",player="Player"} 331.0
cm_traveled{method="falling",player="Player"} 1567.0
cm_traveled{method="flying",player="Player"} 7188.0
# HELP player_xp_total_total How much total XP a player has
# TYPE player_xp_total_total counter
player_xp_total{player="Player"} 0.0
# HELP player_current_level_total How much current XP a player has
# TYPE player_current_level_total counter
player_current_level{player="Player"} 0.0
# HELP player_food_level_total How much food the player currently has
# TYPE player_food_level_total counter
player_food_level{player="Player"} 20.0
# HELP player_health_total How much Health the player currently has
# TYPE player_health_total counter
player_health{player="Player"} 20.0
# HELP player_score_total The Score of the player
# TYPE player_score_total counter
player_score{player="Player"} 0.0
# HELP entities_killed_total Entities killed by player
# TYPE entities_killed_total counter
# HELP damage_taken_total Damage Taken by Player
# TYPE damage_taken_total counter
damage_taken{player="Player"} 260.0
# HELP damage_dealt_total Damage dealt by Player
# TYPE damage_dealt_total counter
# HELP blocks_crafted_total Items a Player crafted
# TYPE blocks_crafted_total counter
# HELP player_playtime_total Time in Minutes a Player was online
# TYPE player_playtime_total counter
player_playtime{player="Player"} 16747.0
# HELP player_advancements_total Number of completed advances of a player
# TYPE player_advancements_total counter
player_advancements{player="Player"} 11.0
# HELP player_slept_total Times a Player slept in a bed
# TYPE player_slept_total counter
# HELP player_used_crafting_table_total Times a Player used a Crafting Table
# TYPE player_used_crafting_table_total counter
# HELP player_quests_finished_total Number of quests a Player has finished
# TYPE player_quests_finished_total counter
# HELP mc_custom_total Custom Minecraft stat
# TYPE mc_custom_total counter
mc_custom{stat="minecraft:time_since_rest"} 15243.0
mc_custom{stat="minecraft:leave_game"} 2.0
mc_custom{stat="minecraft:time_since_death"} 15203.0
mc_custom{stat="minecraft:sneak_time"} 67.0
mc_custom{stat="minecraft:total_world_time"} 16747.0
mc_custom{stat="minecraft:drop"} 1.0
# HELP dim_tps_total TPS of a dimension
# TYPE dim_tps_total counter
# HELP dim_ticktime_total Time a Tick took in a Dimension
# TYPE dim_ticktime_total counter
# HELP overall_tps_total overall TPS
# TYPE overall_tps_total counter
# HELP overall_ticktime_total overall Ticktime
# TYPE overall_ticktime_total counter
# HELP player_online_total is 1 if player is online
# TYPE player_online_total counter
player_online{player="Player"} 1.0
# HELP entities_total type and count of active entites
# TYPE entities_total counter
# HELP paper_tps_1m_total 1 Minute TPS
# TYPE paper_tps_1m_total counter
# HELP paper_tps_5m_total 5 Minute TPS
# TYPE paper_tps_5m_total counter
# HELP paper_tps_15m_total 15 Minute TPS
# TYPE paper_tps_15m_total counter

The README.md mentions spam to the RCON, but I don't see any commands being executed, even when

broadcast-console-to-ops=true
broadcast-rcon-to-ops=true

are enabled.

heathcliff26 commented 1 year ago

Hi, though i haven't read through what metrics you are getting, i can tell you that TPS metrics are dependent on either Forge or Paper. In fact all metrics gathered through RCON are from either Forge, Paper or the Dynmap Plugin.

I made a PR #33 where i renamed, it makes it clearer. Maybe the re-written README.md helps you: https://github.com/heathcliff26/minecraft-exporter/blob/upstream/README.md

joshuai96 commented 1 year ago

Hi, thanks yes. The README.md reads as TPS metrics are only RCON dependent. What a shame. TPS stats are, for me, the most useful stats.

joshuai96 commented 1 year ago

I moved to paper server, changed the ENV file.

RCON_HOST=minecraft-paper-server
RCON_PORT=25575
RCON_PASSWORD=****
FORGE_SERVER=False
PAPER_SERVER=True
DYNMAP_ENABLED=False

printenv inside the Container reads PAPER_SERVER=True, but still no TPS stats are exported.

Excerpt of the exported stats:

# HELP paper_tps_1m_total 1 Minute TPS
# TYPE paper_tps_1m_total counter
# HELP paper_tps_5m_total 5 Minute TPS
# TYPE paper_tps_5m_total counter
# HELP paper_tps_15m_total 15 Minute TPS
# TYPE paper_tps_15m_total counter

As it stands, there are seemingly no RCON commands issued, even though the exported log says:

RCON is enabled for minecraft-paper-server
Successfully connected to RCON
Exporter started on Port 8000
flushing playername cache

server.properties excerpt:

broadcast-console-to-ops=true
broadcast-rcon-to-ops=true

server log excerpt, when restarting the exporter container:

[19:47:30 INFO]: Thread RCON Client /172.18.0.4 shutting down
[19:47:46 INFO]: Thread RCON Client /172.18.0.4 started

I verified functionality of the paper tps command, and checked the used regex in the code. That seems to still match.

I think the error is that seemingly no RCON commands are issued to the RCON.

EDIT: After checking RCON commands with a logged in OP, RCON commands does not seem to be broadcasted to OPs either.

RobbeVerhelst commented 8 months ago

Having the same issue. Can't seem to get any of the rcon metrics. in my server logs I do see that it's querying /list.

[10:23:54 INFO]: [Essentials] Rcon issued server command: /list
[10:24:09 INFO]: [Essentials] Rcon issued server command: /list
[10:24:24 INFO]: [Essentials] Rcon issued server command: /list
[10:24:39 INFO]: [Essentials] Rcon issued server command: /list
[10:24:54 INFO]: [Essentials] Rcon issued server command: /list
[10:25:09 INFO]: [Essentials] Rcon issued server command: /list
[10:25:24 INFO]: [Essentials] Rcon issued server command: /list
[10:25:39 INFO]: [Essentials] Rcon issued server command: /list
[10:25:54 INFO]: [Essentials] Rcon issued server command: /list
[10:26:09 INFO]: [Essentials] Rcon issued server command: /list
[10:26:24 INFO]: [Essentials] Rcon issued server command: /list
[10:26:39 INFO]: [Essentials] Rcon issued server command: /list
[10:26:54 INFO]: [Essentials] Rcon issued server command: /list
[10:27:09 INFO]: [Essentials] Rcon issued server command: /list
[10:27:24 INFO]: [Essentials] Rcon issued server command: /list
[10:27:39 INFO]: [Essentials] Rcon issued server command: /list
[10:27:54 INFO]: [Essentials] Rcon issued server command: /list
image
heathcliff26 commented 8 months ago

Yes, Paper had a new format for the paper tps command output, so it will not parse on 1.20+