Add podocarp/speedtest_exporter package and module (#514624)

This commit is contained in:
Florian Klink
2026-05-14 12:36:40 +00:00
committed by GitHub
3 changed files with 80 additions and 0 deletions
@@ -119,6 +119,7 @@ let
"smartctl"
"smokeping"
"snmp"
"speedtest"
"sql"
"statsd"
"storagebox"
@@ -0,0 +1,51 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.prometheus.exporters.speedtest;
inherit (lib)
mkOption
types
concatStringsSep
optionalString
;
in
{
port = 9798;
extraOpts = {
serverID = mkOption {
type = types.int;
default = -1;
description = ''
Speedtest.net server ID to run tests against.
-1 picks the closest server to your location.
'';
};
serverFallback = mkOption {
type = types.bool;
default = false;
description = ''
If the configured serverID is unavailable, fall back to the closest available server.
'';
};
};
serviceOpts = {
serviceConfig = {
ExecStart = ''
${pkgs.prometheus-speedtest-exporter}/bin/speedtest_exporter \
-listen-address ${cfg.listenAddress} \
-port ${toString cfg.port} \
-server_id ${toString cfg.serverID} \
${optionalString cfg.serverFallback "-server_fallback"} \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
};
};
}
@@ -0,0 +1,28 @@
{
buildGoModule,
lib,
fetchFromGitHub,
}:
buildGoModule (finalAttrs: {
__structuredAttrs = true;
pname = "prometheus-speedtest-exporter";
version = "1.0.0";
src = fetchFromGitHub {
owner = "podocarp";
repo = "speedtest_exporter";
tag = "v${finalAttrs.version}";
hash = "sha256-n9eunZRssS13mTOeFeZ/PpfSj430DKf3ZRS10hY4Ps8=";
};
vendorHash = "sha256-HBg44D0CUc4HYCBwGrswnrqG5o5ltA6UT8L0oWetlIc=";
meta = {
description = "Speedtest.net Exporter for the Prometheus monitoring system";
mainProgram = "speedtest_exporter";
homepage = "https://github.com/podocarp/speedtest_exporter";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ podocarp ];
};
})