1.18.2 (Forge) error
Closed this issue · 4 comments
Getting the following on my TNP Limitless 5 Curseforge pack server (MInecraft v1.18.2, forge v40.1.80):
2022-09-19 13:19:10 | RCON is enabled for tnp-minecraft-rcon.minecraft
2022-09-19 13:19:10 | Successfully connected to RCON
2022-09-19 13:19:10 | Exporter started on Port 8000
2022-09-19 13:19:13 | Traceback (most recent call last):
2022-09-19 13:19:13 | Traceback (most recent call last):
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/wsgiref/handlers.py", line 137, in run
2022-09-19 13:19:13 | self.result = application(self.environ, self.start_response)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/wsgiref/handlers.py", line 137, in run
2022-09-19 13:19:13 | self.result = application(self.environ, self.start_response)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 122, in prometheus_app
2022-09-19 13:19:13 | status, header, output = _bake_output(registry, accept_header, params)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 104, in _bake_output
2022-09-19 13:19:13 | output = encoder(registry)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 122, in prometheus_app
2022-09-19 13:19:13 | status, header, output = _bake_output(registry, accept_header, params)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 104, in _bake_output
2022-09-19 13:19:13 | output = encoder(registry)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 176, in generate_latest
2022-09-19 13:19:13 | for metric in registry.collect():
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 176, in generate_latest
2022-09-19 13:19:13 | for metric in registry.collect():
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/registry.py", line 83, in collect
2022-09-19 13:19:13 | for metric in collector.collect():
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/registry.py", line 83, in collect
2022-09-19 13:19:13 | for metric in collector.collect():
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 368, in collect
2022-09-19 13:19:13 | for metric in self.get_server_stats():
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 368, in collect
2022-09-19 13:19:13 | for metric in self.get_server_stats():
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 112, in get_server_stats
2022-09-19 13:19:13 | resp = self.rcon_command("forge tps")
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 158, in get_server_stats
2022-09-19 13:19:13 | resp = self.rcon_command("list")
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 70, in rcon_command
2022-09-19 13:19:13 | response = self.rcon.command(command)
2022-09-19 13:19:13 | File "//minecraft_exporter.py", line 70, in rcon_command
2022-09-19 13:19:13 | response = self.rcon.command(command)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 129, in command
2022-09-19 13:19:13 | result = self._send(2, command)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 129, in command
2022-09-19 13:19:13 | result = self._send(2, command)
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 112, in _send
2022-09-19 13:19:13 | in_id, in_type = struct.unpack("<ii", in_payload[:8])
2022-09-19 13:19:13 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 112, in _send
2022-09-19 13:19:13 | in_id, in_type = struct.unpack("<ii", in_payload[:8])
2022-09-19 13:19:13 | struct.error: unpack requires a buffer of 8 bytes
2022-09-19 13:19:13 | struct.error: unpack requires a buffer of 8 bytes
2022-09-19 13:19:23 | Traceback (most recent call last):
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/wsgiref/handlers.py", line 137, in run
2022-09-19 13:19:23 | self.result = application(self.environ, self.start_response)
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 122, in prometheus_app
2022-09-19 13:19:23 | status, header, output = _bake_output(registry, accept_header, params)
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 104, in _bake_output
2022-09-19 13:19:23 | output = encoder(registry)
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/exposition.py", line 176, in generate_latest
2022-09-19 13:19:23 | for metric in registry.collect():
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/prometheus_client/registry.py", line 83, in collect
2022-09-19 13:19:23 | for metric in collector.collect():
2022-09-19 13:19:23 | File "//minecraft_exporter.py", line 368, in collect
2022-09-19 13:19:23 | for metric in self.get_server_stats():
2022-09-19 13:19:23 | File "//minecraft_exporter.py", line 112, in get_server_stats
2022-09-19 13:19:23 | resp = self.rcon_command("forge tps")
2022-09-19 13:19:23 | File "//minecraft_exporter.py", line 70, in rcon_command
2022-09-19 13:19:23 | response = self.rcon.command(command)
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 129, in command
2022-09-19 13:19:23 | result = self._send(2, command)
2022-09-19 13:19:23 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 112, in _send
2022-09-19 13:19:23 | in_id, in_type = struct.unpack("<ii", in_payload[:8])
2022-09-19 13:19:23 | struct.error: unpack requires a buffer of 8 bytes
2022-09-19 13:19:28 | Traceback (most recent call last):
2022-09-19 13:19:28 | File "//minecraft_exporter.py", line 385, in <module>
2022-09-19 13:19:28 | time.sleep(1)
2022-09-19 13:19:28 | File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 20, in timeout_handler
2022-09-19 13:19:28 | raise MCRconException("Connection timeout error")
2022-09-19 13:19:28 | mcrcon.MCRconException: Connection timeout error
2022-09-19 13:19:28 |
2022-09-19 13:19:28 | During handling of the above exception, another exception occurred:
2022-09-19 13:19:28 |
2022-09-19 13:19:28 | Traceback (most recent call last):
2022-09-19 13:19:28 | File "//minecraft_exporter.py", line 389, in <module>
2022-09-19 13:19:28 | collector.rcon_disconnect()
2022-09-19 13:19:28 | NameError: name 'collector' is not defined
I have the same issue but with a vanilla server. It looks like the service can't establish a connection to rcon but I'm not able to figure out why. Did you end up finding a workaround?
Can you Post your log output?
Here ya go. Sorry took a bit of time
RCON is enabled for minecraft_vanilla
Successfully connected to RCON
Exporter started on Port 8000
Traceback (most recent call last):
File "//minecraft_exporter.py", line 385, in <module>
time.sleep(1)
File "/usr/local/lib/python3.10/site-packages/mcrcon.py", line 20, in timeout_handler
raise MCRconException("Connection timeout error")
mcrcon.MCRconException: Connection timeout error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "//minecraft_exporter.py", line 389, in <module>
collector.rcon_disconnect()
NameError: name 'collector' is not defined
Here's the compose if that help.
minecraft:
image: joshi425/minecraft_exporter
ports:
- target: 8000
published: 9120
volumes:
- /var/lib/docker/volumes/mc_vanilla_data/_data/surv_docker:/world
environment:
- RCON_HOST=minecraft_vanilla
- RCON_PORT=25575
- RCON_PASSWORD=supersecretpasswordkinda
networks:
- proxy
- minecraft
deploy:
placement:
constraints:
- node.role == manager
replicas: 1
restart_policy:
condition: on-failure
labels:
org.label-schema.group: "monitoring"
I think I figured out my issue but I'm not 100% on that. Essentially itzg's Minecraft server image has a feature where you can autopause the server to save on resources when no user is connected. I don't think rcon works for the server when the world is paused but not sure about that.
Anyways, I removed the autopause feature and ran everything again. It didn't throw out any of the previous exceptions but I still can't see rcon related metrics in Prometheus/Grafana. Those metrics are just not coming through even though rcon seems to be configured properly.
I'm gonna keep testing it with autopause off for a bit to see if I get any weird logs.