summary refs log blame commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters/kea.nix
blob: ed33c72f644f3742fdd96807810704597af83759 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                 
                                    




                                     
                                




                                    



                                
                     
                   



                                                          
                                                        

                                      



                                      


      
{ config
, lib
, pkgs
, options
}:

with lib;

let
  cfg = config.services.prometheus.exporters.kea;
in {
  port = 9547;
  extraOpts = {
    controlSocketPaths = mkOption {
      type = types.listOf types.str;
      example = literalExpression ''
        [
          "/run/kea/kea-dhcp4.socket"
          "/run/kea/kea-dhcp6.socket"
        ]
      '';
      description = lib.mdDoc ''
        Paths to kea control sockets
      '';
    };
  };
  serviceOpts = {
    after = [
      "kea-dhcp4-server.service"
      "kea-dhcp6-server.service"
    ];
    serviceConfig = {
      User = "kea";
      ExecStart = ''
        ${pkgs.prometheus-kea-exporter}/bin/kea-exporter \
          --address ${cfg.listenAddress} \
          --port ${toString cfg.port} \
          ${concatStringsSep " " cfg.controlSocketPaths}
      '';
      SupplementaryGroups = [ "kea" ];
      RestrictAddressFamilies = [
        # Need AF_UNIX to collect data
        "AF_UNIX"
      ];
    };
  };
}