2024-08-31 02:15:09 +00:00
|
|
|
{ config, lib, ... }:
|
2024-08-29 17:42:37 +00:00
|
|
|
{
|
|
|
|
services.prometheus.exporters.node = {
|
|
|
|
enable = true;
|
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
port = 9091;
|
|
|
|
enabledCollectors = [ "systemd" ];
|
|
|
|
};
|
2024-08-31 02:15:09 +00:00
|
|
|
|
2024-09-07 12:38:10 +00:00
|
|
|
services.caddy.settings.apps.http.servers.srv0.metrics = { };
|
|
|
|
services.caddy.settings.apps.http.servers.srv0.routes = [
|
|
|
|
{
|
|
|
|
match = lib.singleton {
|
|
|
|
host = [ config.networking.fqdn ];
|
|
|
|
path = [ "/metrics" ];
|
|
|
|
};
|
|
|
|
handle = [
|
|
|
|
{
|
|
|
|
handler = "authentication";
|
|
|
|
providers.http_basic.accounts = lib.singleton {
|
|
|
|
username = "prometheus";
|
|
|
|
password = "$2a$14$2Phk4tobM04H4XiGegB3TuEXkyORCKMKW8TptYPTPXUWmZgtGBj/.";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
handler = "reverse_proxy";
|
|
|
|
upstreams = lib.singleton { dial = "127.0.0.1:9091"; };
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
match = lib.singleton {
|
|
|
|
host = [ config.networking.fqdn ];
|
|
|
|
path = [ "/caddy" ];
|
|
|
|
};
|
|
|
|
handle = [
|
|
|
|
{
|
|
|
|
handler = "authentication";
|
|
|
|
providers.http_basic.accounts = lib.singleton {
|
|
|
|
username = "prometheus";
|
|
|
|
password = "$2a$14$2Phk4tobM04H4XiGegB3TuEXkyORCKMKW8TptYPTPXUWmZgtGBj/.";
|
|
|
|
};
|
|
|
|
}
|
2024-09-20 17:38:01 +00:00
|
|
|
{ handler = "metrics"; }
|
2024-09-07 12:38:10 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
2024-08-29 17:42:37 +00:00
|
|
|
}
|