Add Minecraft monitoring!

This also fixes some duplicate alert structures we saw earlier
This commit is contained in:
Salt 2024-07-10 01:13:16 -05:00
parent b6dc8629f9
commit e0e0d626f9
2 changed files with 26 additions and 0 deletions

View File

@ -16,6 +16,12 @@
- "25565:25565/tcp" - "25565:25565/tcp"
- "25565:25565/udp" - "25565:25565/udp"
- "24454:24454/udp" - "24454:24454/udp"
# Prometheus exporter for Forge
# https://www.curseforge.com/minecraft/mc-mods/prometheus-exporter
#- "19565:19565/tcp"
# Prometheus exporter for Fabric
# https://modrinth.com/mod/fabricexporter
- "19565:25585/tcp"
volumes: volumes:
- /data/minecraft/createfarming:/data - /data/minecraft/createfarming:/data
tags: [ docker, minecraft, create, createfarming ] tags: [ docker, minecraft, create, createfarming ]

View File

@ -34,6 +34,7 @@ scrape_configs:
static_configs: static_configs:
- targets: - targets:
{% for host in groups['tags_nagios'] %} {% for host in groups['tags_nagios'] %}
{% set vars = hostvars[host] %}
{% for service in vars.services %} {% for service in vars.services %}
{% for tag in service.tags %} {% for tag in service.tags %}
{# #} {# #}
@ -63,6 +64,25 @@ scrape_configs:
static_configs: static_configs:
- targets: ['blackbox:9115'] - targets: ['blackbox:9115']
# This job manages Minecraft servers, when we have them
- job_name: "minecraft"
static_configs:
- targets:
{% for host in groups['tags_nagios'] %}
{% set vars = hostvars[host] %}
{% for service in vars.services %}
{% for tag in service.tags %}
{# #}
{% if tag.slug == "nagios-checkminecraft" %}
{% for port in service.ports %}
- "{{ host }}:{{ port }}"
{% endfor %}
{% endif %}
{# #}
{% endfor %}
{% endfor %}
{% endfor %}
# These two jobs are included for every node in our inventory # These two jobs are included for every node in our inventory
- job_name: "node-exporter" - job_name: "node-exporter"
static_configs: static_configs: