diff --git a/grafana/prometheus.yml b/grafana/prometheus.yml index 1aa5d01..f602635 100644 --- a/grafana/prometheus.yml +++ b/grafana/prometheus.yml @@ -11,11 +11,8 @@ scrape_configs: scrape_interval: 5s static_configs: - targets: ['node_exporter:9100'] - - job_name: 'minecraft_2023' + - job_name: 'minecraft_2023_metrics' scrape_interval: 5s static_configs: - - targets: ['minecraft_2023:9225'] - - job_name: 'minecraft_creative' - scrape_interval: 5s - static_configs: - - targets: ['minecraft_creative:9225'] + - targets: ['minecraft_2023_metrics:2565'] + diff --git a/minecraft/README.md b/minecraft/README.md index 0940687..24256f6 100644 --- a/minecraft/README.md +++ b/minecraft/README.md @@ -5,10 +5,9 @@ PWS hosts Minecraft servers. Based off `https://github.com/itzg/docker-minecraft All server configuration done with env vars. Data stored on disk rather than docker volume so things like the config can be edited via just ssh. -Minecraft emits metrics for prometheus to collect via `https://github.com/sladkoff/minecraft-prometheus-exporter`. Clone the repo & build the project into a jar and copy it into the `/plugins` directory for minecraft. -Take special care to overwrite the plugin's default "hostname" to `0.0.0.0` to allow all traffic in the config file. Otherwise the minecraft target will show up as DOWN in Prometheus. This allows the plugin to listen to traffic from outside the container (namely the prometheus instance). +Minecraft emits metrics for Prometheus to collect for Grafana. We are exporting metrics via the docker container described in `https://github.com/Joshi425/minecraft-exporter`. Change the default port via env variable to make sure there aren't port conflicts. -Monitoring commands to get logs from the container are documented in the github repo. +Monitoring commands to get logs from the minecraft container are documented in the github repo. example: `docker exec minecraft_2023 mc_log` @@ -23,8 +22,6 @@ example: `docker exec minecraft_2023 mc_log` ##### Plugins -Metrics: `https://github.com/sladkoff/minecraft-prometheus-exporter` as described above. Build jar and copy to jars folder. Ensure hostname is set to 0.0.0.0 to allow for remote pings. - SinglePlayerSleep: `https://www.spigotmc.org/resources/singleplayersleep.68139/` Dynmap: `https://www.spigotmc.org/resources/dynmap%C2%AE.274/` diff --git a/minecraft/docker-compose.yml b/minecraft/docker-compose.yml index 4af0ae8..41a0f83 100644 --- a/minecraft/docker-compose.yml +++ b/minecraft/docker-compose.yml @@ -69,3 +69,23 @@ services: - "traefik.http.routers.minemap.rule=Host(`minemap.whitney.rip`)" - "traefik.http.routers.minemap.entrypoints=web" + minecraft_2023_metrics: + image: joshi425/minecraft_exporter:latest + container_name: minecraft_2023_metrics + restart: always + networks: + - minecraft_network + ports: + - 2565:2565 + volumes: + - /data/minecraft_2023/world:/world + environment: + - RCON_HOST=127.0.0.1 + - RCON_PORT=25565 + - HTTP_PORT=2565 + - FORGE_SERVER="False" + - PAPER_SERVER="True" + - DYNMAP_ENABLED="True" + + +