kminion: 2.2.7 → 2.2.13, init module (#318792)

This commit is contained in:
misuzu 2025-08-18 19:30:40 +03:00 committed by GitHub
commit 4b66d476f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 136 additions and 8 deletions

View File

@ -92,6 +92,8 @@
- [conman](https://github.com/dun/conman), a serial console management program. Available as [services.conman](#opt-services.conman.enable).
- [KMinion](https://github.com/redpanda-data/kminion), feature-rich Prometheus exporter for Apache Kafka. Available as [services.prometheus.exporters.kafka](options.html#opt-services.prometheus.exporters.kafka).
## Backward Incompatibilities {#sec-release-25.11-incompatibilities}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

View File

@ -79,6 +79,7 @@ let
"jitsi"
"json"
"junos-czerwonk"
"kafka"
"kea"
"keylight"
"klipper"

View File

@ -0,0 +1,56 @@
{
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" ];
})
]
);
}

View File

@ -587,6 +587,63 @@ let
'';
};
kafka = {
exporterConfig = {
enable = true;
environmentFile = pkgs.writeTextFile {
name = "/tmp/prometheus-kafka-exporter.env";
text = ''
KAFKA_BROKERS="localhost:9092"
'';
};
};
metricProvider = {
services.apache-kafka = {
enable = true;
clusterId = "pHG8aWuXSfWAibHFDCnsCQ";
formatLogDirs = true;
settings = {
"node.id" = 1;
"process.roles" = [
"broker"
"controller"
];
"listeners" = [
"PLAINTEXT://:9092"
"CONTROLLER://:9093"
];
"listener.security.protocol.map" = [
"PLAINTEXT:PLAINTEXT"
"CONTROLLER:PLAINTEXT"
];
"controller.quorum.voters" = [
"1@localhost:9093"
];
"controller.listener.names" = [ "CONTROLLER" ];
"log.dirs" = [ "/var/lib/apache-kafka" ];
};
};
systemd.services.apache-kafka.serviceConfig.StateDirectory = "apache-kafka";
};
exporterTest = ''
wait_for_unit("apache-kafka")
wait_for_open_port(9092)
wait_for_open_port(9093)
wait_for_unit("prometheus-kafka-exporter.service")
wait_for_open_port(8080)
wait_until_succeeds(
"journalctl -o cat -u prometheus-kafka-exporter.service | grep '\"version\":\"${pkgs.kminion.version}\"'"
)
succeed(
"curl -sSf http://localhost:8080/metrics | grep 'kminion_exporter_up'"
)
'';
};
knot = {
exporterConfig = {
enable = true;

View File

@ -2,30 +2,42 @@
lib,
fetchFromGitHub,
buildGoModule,
nixosTests,
}:
buildGoModule {
buildGoModule (finalAttrs: {
pname = "kafka-minion";
version = "2.2.7";
version = "2.2.13";
src = fetchFromGitHub {
owner = "redpanda-data";
repo = "kminion";
rev = "0c90d4301ed4600d1aaf3345b6f16587d2f282fc";
hash = "sha256-CWjX46Sfc9Xj+R7+CZeMuTY0iUStzyZXI4FotwqR44M=";
rev = "v${finalAttrs.version}";
hash = "sha256-s7kHMMU/srqww/N5szTvX6hOFDV9k9hm+0EZUxIj9So=";
};
vendorHash = "sha256-6yfQVoY/bHMA4s0IN5ltnQdHWnE3kIKza36uEcGa11U=";
vendorHash = "sha256-vdbSKEWlFH4UkuBxu0LFs8+Rwa4aWTjE8gD4zKuvcs4=";
doCheck = false;
passthru.updateScript = ./update.sh;
ldflags = [
"-s"
"-w"
"-X main.version=${finalAttrs.version}"
"-X main.builtAt=unknown"
];
passthru = {
tests = {
inherit (nixosTests.prometheus-exporters) kafka;
};
updateScript = ./update.sh;
};
meta = with lib; {
description = "Feature-rich Prometheus exporter for Apache Kafka written in Go";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ cafkafk ];
mainProgram = "kminion";
};
}
})