Flag `--use-server-list-ping` for subcommand `export-for-prometheus`?
#115 opened on Jul 16, 2025
Repository metrics
- Stars
- (316 stars)
- PR merge metrics
- (Avg merge 1h 17m) (9 merged PRs in 30d)
Description
Hello! I'm curious about how a Java Minecraft server on version 1.6.4 can be monitored using the subcommand export-for-prometheus. A while ago the flag --use-server-list-ping was added for the status subcommand in #10, but it is not available for the export-for-prometheus subcommand if I'm correct? I have a few modded servers running on version 1.6.4 (Crash Landing) and I'd love to monitor them using this mc-monitor command/agent.
Below is a minimal working configuration to reproduce the error:
---
services:
server:
image: itzg/minecraft-server:2025.6.2-java8
container_name: mc_server
restart: unless-stopped
networks:
- mc_monitoring_network
ports:
- 25565:25565
environment:
- EULA=TRUE
- VERSION=1.6.4
volumes:
- mc_data:/data
tty: true
stdin_open: true
healthcheck:
test: "mc-monitor status --use-server-list-ping"
start_period: 16s
interval: 5s
retries: 20
monitor:
image: itzg/mc-monitor:0.15.6
container_name: mc_monitor
restart: unless-stopped
command: export-for-prometheus
networks:
- mc_monitoring_network
ports:
- 8080:8080
environment:
- DEBUG=TRUE
- EXPORT_SERVERS=server
networks:
mc_monitoring_network:
volumes:
mc_data:
name: mc_data
The healthcheck of server is configured to use --use-server-list-ping. This indeed works as running docker compose ps produces the following output, first indicating an unhealthy state but later healthy once server is fully started:
| NAME | IMAGE | ... | CREATED | STATUS | ... |
|---|---|---|---|---|---|
| mc_monitor | itzg/mc-monitor:0.15.6 | ... | 36 seconds ago | Up 36 seconds | ... |
| mc_server | itzg/minecraft-server:2025.6.2-java8 | ... | 36 seconds ago | Up 36 seconds (healthy) | ... |
When visiting http://localhost:8080/metrics, monitor queries server and server produces an error. Running docker compose logs --tail 9 server outputs this error:
mc_server | java.io.IOException: Received string length is less than zero! Weird string!
mc_server | at ey.a(SourceFile:243)
mc_server | at eb.a(SourceFile:17)
mc_server | at ey.a(SourceFile:197)
mc_server | at co.i(SourceFile:249)
mc_server | at co.c(SourceFile:17)
mc_server | at cp.run(SourceFile:94)
mc_server | 2025-07-16 18:32:30 [INFO] Disconnecting /172.19.0.2:42818: Protocol error
mc_server | 2025-07-16 18:32:30 [INFO] /172.19.0.2:42818 lost connection
Currently monitor also falsely reports that server is unhealthy in the following metric:
# HELP minecraft_status_healthy Indicates if the server is healthy (1) or not (0)
# TYPE minecraft_status_healthy gauge
minecraft_status_healthy{server_edition="java",server_host="server",server_port="25565",server_version=""} 0
Please note that I completely understand it when this problem won't be fixed. Minecraft version 1.6.4 is very old and I can imagine you have other higher priorities 😅.