2024-02-19 17:37:57 +01:00
|
|
|
{ config, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
host = "prometheus.dgnum.eu";
|
|
|
|
port = 9091;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
services.prometheus = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
inherit port;
|
|
|
|
|
|
|
|
checkConfig = "syntax-only";
|
|
|
|
enableReload = true;
|
|
|
|
|
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
|
|
|
|
webConfigFile = config.age.secrets."prometheus-web_config_file".path;
|
|
|
|
|
|
|
|
webExternalUrl = "https://${host}";
|
|
|
|
|
2024-04-14 01:08:49 +02:00
|
|
|
retentionTime = "6m";
|
|
|
|
|
|
|
|
extraFlags = [ "--storage.tsdb.retention.size=20GB" ];
|
|
|
|
|
|
|
|
globalConfig = {
|
|
|
|
scrape_interval = "15s"; # if you change this settings, please do it in grafana also
|
|
|
|
};
|
|
|
|
|
2024-02-19 17:37:57 +01:00
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "prometheus";
|
|
|
|
static_configs = [ { targets = [ "localhost:9090" ]; } ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${builtins.toString port}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
age-secrets.autoMatch = [ "prometheus" ];
|
|
|
|
}
|