Set up monitoring via Prometheus and Grafana

This commit is contained in:
2023-03-23 07:43:07 +01:00
parent 231a4b663e
commit 4336861678
2 changed files with 51 additions and 0 deletions

View File

@@ -42,4 +42,41 @@ with pkgs;
};
};
# Metrics collection
services.prometheus = {
enable = true;
port = 9001;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9002;
};
zfs.enable = true;
wireguard.enable = true;
postgres.enable = true;
smartctl.enable = true;
#nginx.enable = true;
dnsmasq.enable = true;
};
scrapeConfigs = [{
job_name = "zion";
static_configs = [{
targets = [
"localhost:${toString config.services.prometheus.exporters.node.port}"
];
}];
}];
};
# Grafana configuration
services.grafana = {
enable = true;
settings.server = {
domain = "grafana.coolneng.duckdns.org";
http_port = 9009;
http_addr = "127.0.0.1";
};
};
}