Repository navigation
Building from source
The exporter is a single Go program. You need Go 1.27 (the toolchain line in go.mod names the exact version) and, for the image, Docker.
-
Clone the repository:
git clone https://github.com/MairwunNx/minecraft-exporter.git cd minecraft-exporter -
Run the tests:
go test ./.... They use a fake WorldAPI and never touch the network. -
Build:
go build .. The binary reports its version asdev.
To stamp a version and build for another system, as the release does:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags "-s -w -X main.version=1.2.3" -o minecraft-exporter .docker build --build-arg VERSION=1.2.3 -t minecraft-exporter:test .The Dockerfile compiles on the build machine's own architecture and cross-compiles for the target, so a multi-arch build (docker buildx build --platform linux/amd64,linux/arm64 .) needs no emulation. The final image is gcr.io/distroless/static-debian13:nonroot: the binary alone, run as a non-root user, listening on 10059.
WORLDAPI_URL=http://localhost:8110/api/v1 EXPORTER_LISTEN=127.0.0.1:10059 go run .
curl -s 127.0.0.1:10059/metrics | grep '^minecraft_'To see the dashboard with your build, tag the image minecraft-exporter:test, change the exporter's image: in examples/compose.yaml to it, and start the stack as Installation shows.
Next: Architecture.
For server owners
For developers