2023-12-03 13:19:30 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
flake,
|
|
|
|
...
|
|
|
|
}: {
|
2023-12-06 18:51:27 +00:00
|
|
|
age.secrets.nachtigall-metrics-prometheus-basic-auth-password = {
|
|
|
|
file = "${flake.self}/secrets/nachtigall-metrics-prometheus-basic-auth-password.age";
|
|
|
|
mode = "600";
|
|
|
|
owner = "prometheus";
|
|
|
|
};
|
|
|
|
|
2023-12-03 13:19:30 +00:00
|
|
|
services.prometheus = {
|
|
|
|
enable = true;
|
|
|
|
port = 9001;
|
|
|
|
exporters = {
|
|
|
|
node = {
|
|
|
|
enable = true;
|
|
|
|
enabledCollectors = [ "systemd" ];
|
|
|
|
port = 9002;
|
|
|
|
};
|
|
|
|
};
|
2023-12-06 18:51:27 +00:00
|
|
|
globalConfig = {
|
|
|
|
scrape_interval = "10s";
|
|
|
|
scrape_timeout = "9s";
|
|
|
|
};
|
2023-12-03 13:19:30 +00:00
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
2023-12-06 18:51:27 +00:00
|
|
|
job_name = "http-targets";
|
2023-12-03 13:19:30 +00:00
|
|
|
static_configs = [{
|
|
|
|
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ];
|
2023-12-05 12:52:39 +00:00
|
|
|
labels = {
|
|
|
|
instance = "flora-6";
|
|
|
|
};
|
2023-12-03 13:19:30 +00:00
|
|
|
}];
|
|
|
|
}
|
2023-12-06 18:11:45 +00:00
|
|
|
{
|
|
|
|
job_name = "https-targets";
|
|
|
|
scheme = "https";
|
|
|
|
metrics_path = "/metrics";
|
|
|
|
basic_auth = {
|
|
|
|
username = "hakkonaut";
|
|
|
|
password_file = "${config.age.secrets.nachtigall-metrics-prometheus-basic-auth-password.path}";
|
|
|
|
};
|
|
|
|
static_configs = [{
|
|
|
|
targets = [ "nachtigall.pub.solar" ];
|
|
|
|
labels = {
|
|
|
|
instance = "nachtigall";
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
}
|
2023-12-03 13:19:30 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|