{ config, pkgs, ... }: {
  # Enable Prometheus exporters
  services.prometheus = {
    exporters = {
      node = {
        enable = true;
        enabledCollectors = [
          "systemd"
          "cpu"
          "cpufreq"
          "diskstats"
          "filesystem"
          "meminfo"
          "netstat"
          "os"
        ];
        port = 9002;
      };
      nginx = {
        enable = true;
        port = 9003;
      };
      process = {
        enable = true;
        port = 9005;
        settings.process_names = [
          # Remove nix store path from process name
          {
            name = "{{.Matches.Wrapped}} {{ .Matches.Args }}";
            cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ];
          }
        ];
      };
    };
  };

  services.telegraf = {
    enable = true;
    extraConfig = {
      inputs.x509_cert = {
        sources = [ "https://technogothic.net:443" ];
        interval = "10m";
      };
      outputs.prometheus_client = {
        listen = "localhost:9004";
        metric_version = 2;
      };
    };
  };
}

