1{ config, lib, pkgs, options }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.bind; 7in 8{ 9 port = 9119; 10 extraOpts = { 11 bindURI = mkOption { 12 type = types.str; 13 default = "http://localhost:8053/"; 14 description = lib.mdDoc '' 15 HTTP XML API address of an Bind server. 16 ''; 17 }; 18 bindTimeout = mkOption { 19 type = types.str; 20 default = "10s"; 21 description = lib.mdDoc '' 22 Timeout for trying to get stats from Bind. 23 ''; 24 }; 25 bindVersion = mkOption { 26 type = types.enum [ "xml.v2" "xml.v3" "auto" ]; 27 default = "auto"; 28 description = lib.mdDoc '' 29 BIND statistics version. Can be detected automatically. 30 ''; 31 }; 32 bindGroups = mkOption { 33 type = types.listOf (types.enum [ "server" "view" "tasks" ]); 34 default = [ "server" "view" ]; 35 description = lib.mdDoc '' 36 List of statistics to collect. Available: [server, view, tasks] 37 ''; 38 }; 39 }; 40 serviceOpts = { 41 serviceConfig = { 42 ExecStart = '' 43 ${pkgs.prometheus-bind-exporter}/bin/bind_exporter \ 44 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ 45 --bind.pid-file /var/run/named/named.pid \ 46 --bind.timeout ${toString cfg.bindTimeout} \ 47 --bind.stats-url ${cfg.bindURI} \ 48 --bind.stats-version ${cfg.bindVersion} \ 49 --bind.stats-groups ${concatStringsSep "," cfg.bindGroups} \ 50 ${concatStringsSep " \\\n " cfg.extraFlags} 51 ''; 52 }; 53 }; 54}