diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 28144b6267c2..35a89ab1bf71 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -79,6 +79,7 @@ let "jitsi" "json" "junos-czerwonk" + "kafka" "kea" "keylight" "klipper" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/kafka.nix b/nixos/modules/services/monitoring/prometheus/exporters/kafka.nix new file mode 100644 index 000000000000..6fa206d3dae2 --- /dev/null +++ b/nixos/modules/services/monitoring/prometheus/exporters/kafka.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.services.prometheus.exporters.kafka; + inherit (lib) + mkIf + mkOption + mkMerge + types + concatStringsSep + ; +in { + port = 8080; + + extraOpts = { + package = lib.mkPackageOption pkgs "kminion" { }; + + environmentFile = mkOption { + type = with types; nullOr path; + default = null; + description = '' + File containing the credentials to access the repository, in the + format of an EnvironmentFile as described by systemd.exec(5) + ''; + }; + }; + serviceOpts = mkMerge ([{ + serviceConfig = { + ExecStart = '' + ${lib.getExe cfg.package} + ''; + EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile; + RestartSec = "5s"; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + ]; + }; + }] ++ [ + (mkIf config.services.apache-kafka.enable { + after = [ "apache-kafka.service" ]; + requires = [ "apache-kafka.service" ]; + }) + ]); +}