2023-12-30 13:09:30 +01:00
|
|
|
{ config, ... } :
|
|
|
|
let
|
|
|
|
root_host = "grimmauld.de";
|
|
|
|
prometheus_host = "prometheus.${root_host}";
|
|
|
|
prometheus_port = 9090; # netstat -nlp | grep 9090
|
|
|
|
in {
|
|
|
|
security.acme.certs."${root_host}".extraDomainNames = [ prometheus_host];
|
|
|
|
|
|
|
|
services.prometheus = {
|
|
|
|
enable = true;
|
|
|
|
port = prometheus_port;
|
|
|
|
globalConfig.scrape_interval = "15s";
|
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "chrysalis";
|
|
|
|
static_configs = [{
|
|
|
|
targets = [
|
|
|
|
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
|
|
|
|
"127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}"
|
2023-12-30 13:13:20 +01:00
|
|
|
"127.0.0.1:${toString config.services.prometheus.exporters.postgres.port}"
|
2023-12-30 13:09:30 +01:00
|
|
|
];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
exporters = {
|
|
|
|
nginx.enable = true;
|
|
|
|
redis.enable = true;
|
|
|
|
domain.enable = true;
|
|
|
|
postgres.enable = true;
|
|
|
|
nginxlog.enable = true;
|
|
|
|
jitsi.enable = true;
|
|
|
|
node = {
|
|
|
|
enable = true;
|
|
|
|
enabledCollectors = [ "systemd" ];
|
|
|
|
port = 9002;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."${prometheus_host}" = {
|
|
|
|
serverName = prometheus_host;
|
|
|
|
forceSSL = true;
|
|
|
|
useACMEHost = root_host;
|
|
|
|
locations."/" = {
|
|
|
|
# proxyPass = "http://127.0.0.1:${builtins.toString config.services.prometheus.port}";
|
|
|
|
return = "307 https://${root_host}"; # nuh uh, no raw prometheus access for you!
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|