28 lines
746 B
Nix
28 lines
746 B
Nix
{ config, ... }:
|
|
|
|
let
|
|
prometheus_user = config.systemd.services.prometheus.serviceConfig.User;
|
|
|
|
fullDataDirPath = "/var/lib/${config.services.prometheus.stateDir}";
|
|
|
|
filesetPath = config.mine.zfsMounts."rpool/safe/svcs/prometheus";
|
|
in {
|
|
services.prometheus = {
|
|
enable = true;
|
|
globalConfig.scrape_interval = "10s";
|
|
globalConfig.scrape_timeout = "10s";
|
|
listenAddress = "localhost";
|
|
|
|
# default is 15 days, we just set it to 14 to be explicit
|
|
retentionTime = "14d";
|
|
};
|
|
|
|
fileSystems."${filesetPath}".neededForBoot = true;
|
|
environment.persistence."${filesetPath}".directories = [
|
|
fullDataDirPath
|
|
];
|
|
|
|
systemd.tmpfiles.rules = [
|
|
"Z ${fullDataDirPath} 0770 ${prometheus_user} ${prometheus_user} -"
|
|
];
|
|
}
|