faet: add more monitoring to minecraft

This commit is contained in:
Jet 2026-03-18 16:08:53 -07:00
parent 1e2a2dd0d9
commit f67f90dffa
No known key found for this signature in database
2 changed files with 748 additions and 3 deletions

View file

@ -1,6 +1,20 @@
{ config, pkgs, ... }:
{
# Minecraft Prometheus exporter (player count, server status, ping)
virtualisation.oci-containers.containers.mc-monitor = {
image = "itzg/mc-monitor:latest";
extraOptions = [ "--network=host" ];
dependsOn = [ "minecraft" ];
cmd = [ "export-for-prometheus" "--servers" "localhost:25565" "--port" "9150" ];
};
# Container metrics (CPU, memory, network, disk I/O per container)
services.cadvisor = {
enable = true;
port = 9180;
};
services.prometheus = {
enable = true;
port = 9090;
@ -40,6 +54,22 @@
}];
scrape_interval = "15s";
}
{
job_name = "minecraft";
static_configs = [{
targets = [ "localhost:9150" ];
labels = { instance = "minecraft-server"; };
}];
scrape_interval = "15s";
}
{
job_name = "cadvisor";
static_configs = [{
targets = [ "localhost:9180" ];
labels = { instance = "minecraft-server"; };
}];
scrape_interval = "15s";
}
];
};
@ -68,6 +98,7 @@
{
name = "Prometheus";
type = "prometheus";
uid = "prometheus";
url = "http://localhost:9090";
isDefault = true;
editable = false;
@ -76,9 +107,9 @@
dashboards.settings.providers = [
{
name = "Node Exporter Full";
options.path = "${pkgs.writeTextDir "dashboards/node-exporter-full.json"
(builtins.readFile ../configs/node-exporter-full.json)}/dashboards";
name = "Minecraft Server";
options.path = "${pkgs.writeTextDir "dashboards/minecraft.json"
(builtins.readFile ../configs/minecraft-dashboard.json)}/dashboards";
options.foldersFromFilesStructure = false;
}
];