1{ config, lib, pkgs }: 2 3with lib; 4 5let 6 cfg = config.services.prometheus.exporters.blackbox; 7in 8{ 9 port = 9115; 10 extraOpts = { 11 configFile = mkOption { 12 type = types.path; 13 description = '' 14 Path to configuration file. 15 ''; 16 }; 17 }; 18 serviceOpts = { 19 serviceConfig = { 20 AmbientCapabilities = [ "CAP_NET_RAW" ]; # for ping probes 21 DynamicUser = true; 22 ExecStart = '' 23 ${pkgs.prometheus-blackbox-exporter}/bin/blackbox_exporter \ 24 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ 25 --config.file ${cfg.configFile} \ 26 ${concatStringsSep " \\\n " cfg.extraFlags} 27 ''; 28 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 29 }; 30 }; 31}