nix/nixos/services/prometheus.nix
Tristan 123e7088f5 alpine: many changes
- updates
- snapserver
- graphana dashboards
- loki
- ddclient
- arr suite, jellyseer
- mautrix fixes
2025-01-18 00:18:11 +00:00

42 lines
941 B
Nix

{config, ...}: let
inherit (config.services) prometheus;
nodes = [
"alpine"
"fcs-tristan-nixbook"
"zenix"
];
addPort = ip: "${ip}:${toString prometheus.exporters.node.port}";
in {
services.prometheus = {
enable = true;
scrapeConfigs = [
{
job_name = "nodes";
static_configs = [
{
targets = builtins.map addPort nodes;
}
];
}
{
job_name = "prometheus";
static_configs = [
{
targets = ["localhost:${toString config.services.prometheus.exporters.postgres.port}"];
}
];
}
];
exporters = {
postgres = {
enable = true;
runAsLocalSuperUser = true;
};
};
};
services.grafana.provision.datasources.settings.datasources = [{
name = "Prometheus";
type = "prometheus";
url = "http://localhost:${toString prometheus.port}";
}];
}