Files
nixos/services/prometheus.nix

48 lines
985 B
Nix

# Module: services/prometheus
# Enables the Prometheus metrics server
{
config,
lib,
pkgs,
pkgsUnstable,
inputs,
...
}:
with lib;
let
cfg = config.prometheus;
httpPort = 3100;
grpcPort = 9096;
in
{
options.prometheus = {
enable = mkEnableOption "Enables prometheus module";
};
config = mkIf cfg.enable {
services.prometheus = {
enable = true;
enableReload = true;
package = pkgsUnstable.prometheus;
# We want to be able to check for validity in spite of available credentials
checkConfig = "syntax-only";
extraFlags = [ "--web.enable-remote-write-receiver" ];
retentionTime = "7d";
#remoteWrite = [
# {
# name = "primary";
# url = "http://log-01.tail755c5.ts.net:9090/api/v1/write";
# basic_auth = {
# username = "alloy";
# password_file = ''${config.sops.secrets."prometheus/password".path}'';
# };
# }
#];
};
};
}