10 cfg = config.services.prometheus.exporters.unbound;
23 (mkRemovedOptionModule [
25 ] "This option was removed, use the `unbound.host` option instead.")
26 (mkRemovedOptionModule [
28 ] "This option was removed, use the `unbound.host` option instead.")
30 options.warnings = options.warnings;
31 options.assertions = options.assertions;
37 telemetryPath = mkOption {
41 Path under which to expose metrics.
47 type = types.nullOr types.path;
48 default = "/var/lib/unbound/unbound_server.pem";
51 Path to the Unbound server certificate authority
55 certificate = mkOption {
56 type = types.nullOr types.path;
57 default = "/var/lib/unbound/unbound_control.pem";
60 Path to the Unbound control socket certificate
65 type = types.nullOr types.path;
66 default = "/var/lib/unbound/unbound_control.key";
69 Path to the Unbound control socket key.
75 default = "tcp://127.0.0.1:8953";
76 example = "unix:///run/unbound/unbound.socket";
78 Path to the unbound control socket. Supports unix domain sockets, as well as the TCP interface.
84 serviceOpts = mkMerge (
89 User = "unbound"; # to access the unbound_control.key
91 ${pkgs.prometheus-unbound-exporter}/bin/unbound_exporter \
92 --unbound.host "${cfg.unbound.host}" \
93 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
94 --web.telemetry-path ${cfg.telemetryPath} \
95 ${optionalString (cfg.unbound.ca != null) "--unbound.ca ${cfg.unbound.ca}"} \
96 ${optionalString (cfg.unbound.certificate != null) "--unbound.cert ${cfg.unbound.certificate}"} \
97 ${optionalString (cfg.unbound.key != null) "--unbound.key ${cfg.unbound.key}"} \
98 ${toString cfg.extraFlags}
100 RestrictAddressFamilies = [
106 // optionalAttrs (!config.services.unbound.enable) {
112 (mkIf config.services.unbound.enable {
113 after = [ "unbound.service" ];
114 requires = [ "unbound.service" ];