Merge pull request #202710 from lukegb/unpoller

unifi-poller: rename to unpoller
This commit is contained in:
Luke Granger-Brown 2022-12-03 12:30:58 -08:00 committed by GitHub
commit 386563c4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 48 additions and 29 deletions

View File

@ -139,6 +139,13 @@
the Nix store.
</para>
</listitem>
<listitem>
<para>
The <literal>unifi-poller</literal> package and corresponding
NixOS module have been renamed to <literal>unpoller</literal>
to match upstream.
</para>
</listitem>
</itemizedlist>
</section>
</section>

View File

@ -44,3 +44,5 @@ In addition to numerous new and upgraded packages, this release has the followin
- A new `virtualisation.rosetta` module was added to allow running `x86_64` binaries through [Rosetta](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) inside virtualised NixOS guests on Apple silicon. This feature works by default with the [UTM](https://docs.getutm.app/) virtualisation [package](https://search.nixos.org/packages?channel=unstable&show=utm&from=0&size=1&sort=relevance&type=packages&query=utm).
- Resilio sync secret keys can now be provided using a secrets file at runtime, preventing these secrets from ending up in the Nix store.
- The `unifi-poller` package and corresponding NixOS module have been renamed to `unpoller` to match upstream.

View File

@ -724,7 +724,7 @@
./services/monitoring/thanos.nix
./services/monitoring/tremor-rs.nix
./services/monitoring/tuptime.nix
./services/monitoring/unifi-poller.nix
./services/monitoring/unpoller.nix
./services/monitoring/ups.nix
./services/monitoring/uptime.nix
./services/monitoring/vmagent.nix

View File

@ -73,7 +73,7 @@ let
"tor"
"unbound"
"unifi"
"unifi-poller"
"unpoller"
"v2ray"
"varnish"
"wireguard"
@ -230,6 +230,10 @@ in
options.services.prometheus.exporters = mkOption {
type = types.submodule {
options = (mkSubModules);
imports = [
../../../misc/assertions.nix
(lib.mkRenamedOptionModule [ "unifi-poller" ] [ "unpoller" ])
];
};
description = lib.mdDoc "Prometheus exporter configuration";
default = {};
@ -293,13 +297,14 @@ in
Please specify either 'services.prometheus.exporters.sql.configuration' or
'services.prometheus.exporters.sql.configFile'
'';
} ] ++ (flip map (attrNames cfg) (exporter: {
} ] ++ (flip map (attrNames exporterOpts) (exporter: {
assertion = cfg.${exporter}.firewallFilter != null -> cfg.${exporter}.openFirewall;
message = ''
The `firewallFilter'-option of exporter ${exporter} doesn't have any effect unless
`openFirewall' is set to `true'!
'';
}));
})) ++ config.services.prometheus.exporters.assertions;
warnings = config.services.prometheus.exporters.warnings;
}] ++ [(mkIf config.services.minio.enable {
services.prometheus.exporters.minio.minioAddress = mkDefault "http://localhost:9000";
services.prometheus.exporters.minio.minioAccessKey = mkDefault config.services.minio.accessKey;

View File

@ -3,9 +3,9 @@
with lib;
let
cfg = config.services.prometheus.exporters.unifi-poller;
cfg = config.services.prometheus.exporters.unpoller;
configFile = pkgs.writeText "prometheus-unifi-poller-exporter.json" (generators.toJSON {} {
configFile = pkgs.writeText "prometheus-unpoller-exporter.json" (generators.toJSON {} {
poller = { inherit (cfg.log) debug quiet; };
unifi = { inherit (cfg) controllers; };
influxdb.disable = true;
@ -21,8 +21,8 @@ in {
port = 9130;
extraOpts = {
inherit (options.services.unifi-poller.unifi) controllers;
inherit (options.services.unifi-poller) loki;
inherit (options.services.unpoller.unifi) controllers;
inherit (options.services.unpoller) loki;
log = {
debug = mkEnableOption (lib.mdDoc "debug logging including line numbers, high resolution timestamps, per-device logs.");
quiet = mkEnableOption (lib.mdDoc "startup and error logs only.");
@ -31,7 +31,7 @@ in {
};
serviceOpts.serviceConfig = {
ExecStart = "${pkgs.unifi-poller}/bin/unpoller --config ${configFile}";
ExecStart = "${pkgs.unpoller}/bin/unpoller --config ${configFile}";
DynamicUser = false;
};
}

View File

@ -3,15 +3,19 @@
with lib;
let
cfg = config.services.unifi-poller;
cfg = config.services.unpoller;
configFile = pkgs.writeText "unifi-poller.json" (generators.toJSON {} {
configFile = pkgs.writeText "unpoller.json" (generators.toJSON {} {
inherit (cfg) poller influxdb loki prometheus unifi;
});
in {
options.services.unifi-poller = {
enable = mkEnableOption (lib.mdDoc "unifi-poller");
imports = [
(lib.mkRenamedOptionModule [ "services" "unifi-poller" ] [ "services" "unpoller" ])
];
options.services.unpoller = {
enable = mkEnableOption (lib.mdDoc "unpoller");
poller = {
debug = mkOption {
@ -86,8 +90,8 @@ in {
};
pass = mkOption {
type = types.path;
default = pkgs.writeText "unifi-poller-influxdb-default.password" "unifipoller";
defaultText = literalExpression "unifi-poller-influxdb-default.password";
default = pkgs.writeText "unpoller-influxdb-default.password" "unifipoller";
defaultText = literalExpression "unpoller-influxdb-default.password";
description = lib.mdDoc ''
Path of a file containing the password for influxdb.
This file needs to be readable by the unifi-poller user.
@ -135,8 +139,8 @@ in {
};
pass = mkOption {
type = types.path;
default = pkgs.writeText "unifi-poller-loki-default.password" "";
defaultText = "unifi-poller-influxdb-default.password";
default = pkgs.writeText "unpoller-loki-default.password" "";
defaultText = "unpoller-influxdb-default.password";
description = lib.mdDoc ''
Path of a file containing the password for Loki.
This file needs to be readable by the unifi-poller user.
@ -184,8 +188,8 @@ in {
};
pass = mkOption {
type = types.path;
default = pkgs.writeText "unifi-poller-unifi-default.password" "unifi";
defaultText = literalExpression "unifi-poller-unifi-default.password";
default = pkgs.writeText "unpoller-unifi-default.password" "unifi";
defaultText = literalExpression "unpoller-unifi-default.password";
description = lib.mdDoc ''
Path of a file containing the password for the unifi service user.
This file needs to be readable by the unifi-poller user.
@ -303,7 +307,7 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${pkgs.unifi-poller}/bin/unifi-poller --config ${configFile}";
ExecStart = "${pkgs.unpoller}/bin/unpoller --config ${configFile}";
Restart = "always";
PrivateTmp = true;
ProtectHome = true;

View File

@ -1244,15 +1244,15 @@ let
'';
};
unifi-poller = {
nodeName = "unifi_poller";
unpoller = {
nodeName = "unpoller";
exporterConfig.enable = true;
exporterConfig.controllers = [{ }];
exporterTest = ''
wait_for_unit("prometheus-unifi-poller-exporter.service")
wait_for_unit("prometheus-unpoller-exporter.service")
wait_for_open_port(9130)
succeed(
"curl -sSf localhost:9130/metrics | grep 'unifipoller_build_info{.\\+} 1'"
"curl -sSf localhost:9130/metrics | grep 'unpoller_build_info{.\\+} 1'"
)
'';
};

View File

@ -4,12 +4,12 @@
}:
buildGoModule rec {
pname = "unifi-poller";
pname = "unpoller";
version = "2.2.0";
src = fetchFromGitHub {
owner = "unifi-poller";
repo = "unifi-poller";
owner = "unpoller";
repo = "unpoller";
rev = "v${version}";
hash = "sha256-jPatTo+5nQ73AETXI88x/bma0wlY333DNvuyaYQTgz0=";
};
@ -26,7 +26,7 @@ buildGoModule rec {
meta = with lib; {
description = "Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus";
homepage = "https://github.com/unifi-poller/unifi-poller";
homepage = "https://github.com/unpoller/unpoller";
changelog = "https://github.com/unpoller/unpoller/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ ];

View File

@ -1531,6 +1531,7 @@ mapAliases ({
ufraw = throw "ufraw is unmaintained and has been removed from nixpkgs. Its successor, nufraw, doesn't seem to be stable enough. Consider using Darktable for now"; # Added 2020-01-11
ultrastardx-beta = throw "'ultrastardx-beta' has been renamed to/replaced by 'ultrastardx'"; # Converted to throw 2022-02-22
unicorn-emu = unicorn; # Added 2020-10-29
unifi-poller = unpoller; # Added 2022-11-24
unifiStable = unifi6; # Added 2020-12-28
unity3d = throw "'unity3d' is unmaintained, has seen no updates in years and depends on deprecated GTK2"; # Added 2022-06-16
untrunc = untrunc-anthwlock; # Added 2021-02-01

View File

@ -38058,7 +38058,7 @@ with pkgs;
texlive = texlive.combined.scheme-medium;
};
unifi-poller = callPackage ../servers/monitoring/unifi-poller {};
unpoller = callPackage ../servers/monitoring/unpoller {};
fac-build = callPackage ../development/tools/build-managers/fac {
inherit (darwin.apple_sdk.frameworks) CoreServices;