init minecraft server configs!

This commit is contained in:
Jet Pham 2026-03-13 23:36:43 -07:00
commit 64820d502a
No known key found for this signature in database
23 changed files with 24719 additions and 0 deletions

86
modules/monitoring.nix Normal file
View file

@ -0,0 +1,86 @@
{ config, pkgs, ... }:
{
services.prometheus = {
enable = true;
port = 9090;
retentionTime = "30d";
exporters = {
node = {
enable = true;
port = 9100;
enabledCollectors = [
"cpu"
"diskstats"
"filesystem"
"loadavg"
"meminfo"
"netdev"
"netstat"
"stat"
"time"
"vmstat"
"systemd"
"processes"
"interrupts"
"conntrack"
"tcpstat"
];
};
};
scrapeConfigs = [
{
job_name = "node";
static_configs = [{
targets = [ "localhost:9100" ];
labels = { instance = "minecraft-server"; };
}];
scrape_interval = "15s";
}
];
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 3000;
domain = "status.minecraft.compsigh.club";
root_url = "https://status.minecraft.compsigh.club";
};
security = {
admin_user = "admin";
admin_password = "$__file{${config.age.secrets.grafana-admin-password.path}}";
secret_key = "$__file{${config.age.secrets.grafana-secret-key.path}}";
};
"auth.anonymous".enabled = false;
users.allow_sign_up = false;
};
provision = {
enable = true;
datasources.settings.datasources = [
{
name = "Prometheus";
type = "prometheus";
url = "http://localhost:9090";
isDefault = true;
editable = false;
}
];
dashboards.settings.providers = [
{
name = "Node Exporter Full";
options.path = "${pkgs.writeTextDir "dashboards/node-exporter-full.json"
(builtins.readFile ../configs/node-exporter-full.json)}/dashboards";
options.foldersFromFilesStructure = false;
}
];
};
};
}