2024-04-01 15:53:31 +02:00
|
|
|
{ config, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
host = "prometheus.hackens.org";
|
|
|
|
port = 9091;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
services.prometheus = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
inherit port;
|
|
|
|
|
|
|
|
checkConfig = "syntax-only";
|
|
|
|
enableReload = true;
|
|
|
|
|
|
|
|
listenAddress = "127.0.0.1";
|
|
|
|
|
|
|
|
webConfigFile = config.age.secrets."prometheus-webconf".path;
|
|
|
|
|
|
|
|
webExternalUrl = "https://${host}";
|
|
|
|
|
2024-04-13 23:40:41 +02:00
|
|
|
retentionTime = "5y";
|
|
|
|
|
2024-06-09 15:27:25 +02:00
|
|
|
extraFlags = [ "--storage.tsdb.retention.size=2GB" ];
|
2024-04-13 23:40:41 +02:00
|
|
|
|
2024-09-24 12:33:51 +02:00
|
|
|
rules = [
|
|
|
|
''
|
|
|
|
groups:
|
|
|
|
- name: Chrony
|
|
|
|
rules:
|
|
|
|
- record: instance:chrony_clock_error_seconds:abs
|
|
|
|
expr: >
|
|
|
|
abs(chrony_tracking_last_offset_seconds)
|
|
|
|
+
|
|
|
|
chrony_tracking_root_dispersion_seconds
|
|
|
|
+
|
|
|
|
(0.5 * chrony_tracking_root_delay_seconds)
|
|
|
|
''
|
|
|
|
];
|
2024-04-01 15:53:31 +02:00
|
|
|
|
|
|
|
scrapeConfigs = [
|
|
|
|
{
|
|
|
|
job_name = "prometheus";
|
|
|
|
static_configs = [ { targets = [ "localhost:9090" ]; } ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
job_name = "chrony";
|
|
|
|
static_configs = [ { targets = [ "10.10.10.3:9123" ]; } ];
|
|
|
|
}
|
2024-04-13 23:40:41 +02:00
|
|
|
{
|
|
|
|
job_name = "kfet";
|
|
|
|
static_configs = [ { targets = [ "127.0.0.1:9802" ]; } ];
|
|
|
|
}
|
2024-04-01 15:53:31 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${builtins.toString port}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|