87 lines
2 KiB
Nix
87 lines
2 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
services.prometheus = {
|
|
enable = true;
|
|
port = 9090;
|
|
retentionTime = "30d";
|
|
extraFlags = [ "--storage.tsdb.retention.size=1GB" ];
|
|
|
|
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.mc.compsigh.club";
|
|
root_url = "https://status.mc.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;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|