extremist-software/modules/monitoring.nix

63 lines
1.4 KiB
Nix

{ config, pkgs, ... }:
{
services.prometheus = {
enable = true;
port = 9090;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9100;
};
# Stalwart and Conduit might have exporters too
};
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = [ "127.0.0.1:9100" ];
}
];
}
];
};
services.grafana = {
enable = true;
settings = {
server = {
http_port = 3001;
http_addr = "127.0.0.1";
domain = "status.extremist.software";
};
security = {
secret_key = "$__file{/run/agenix/grafana-secret}";
};
};
provision = {
enable = true;
datasources.settings.datasources = [
{
name = "Prometheus";
type = "prometheus";
access = "proxy";
url = "http://127.0.0.1:9090";
isDefault = true;
}
];
dashboards.settings.providers = [
{
name = "Node Exporter Full";
options.path = "/etc/grafana-dashboards";
}
];
};
};
environment.etc."grafana-dashboards/node-exporter-full.json".source = pkgs.fetchurl {
url = "https://grafana.com/api/dashboards/1860/revisions/37/download";
sha256 = "0qza4j8lywrj08bqbww52dgh2p2b9rkhq5p313g72i57lrlkacfl";
};
}