nixos/prometheus/unifi-poller: rename to unpoller.
This commit is contained in:
parent
ffcd97b521
commit
c7918fed9e
|
@ -73,7 +73,7 @@ let
|
||||||
"tor"
|
"tor"
|
||||||
"unbound"
|
"unbound"
|
||||||
"unifi"
|
"unifi"
|
||||||
"unifi-poller"
|
"unpoller"
|
||||||
"v2ray"
|
"v2ray"
|
||||||
"varnish"
|
"varnish"
|
||||||
"wireguard"
|
"wireguard"
|
||||||
|
@ -230,6 +230,10 @@ in
|
||||||
options.services.prometheus.exporters = mkOption {
|
options.services.prometheus.exporters = mkOption {
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = (mkSubModules);
|
options = (mkSubModules);
|
||||||
|
imports = [
|
||||||
|
../../../misc/assertions.nix
|
||||||
|
(lib.mkRenamedOptionModule [ "unifi-poller" ] [ "unpoller" ])
|
||||||
|
];
|
||||||
};
|
};
|
||||||
description = lib.mdDoc "Prometheus exporter configuration";
|
description = lib.mdDoc "Prometheus exporter configuration";
|
||||||
default = {};
|
default = {};
|
||||||
|
@ -293,13 +297,14 @@ in
|
||||||
Please specify either 'services.prometheus.exporters.sql.configuration' or
|
Please specify either 'services.prometheus.exporters.sql.configuration' or
|
||||||
'services.prometheus.exporters.sql.configFile'
|
'services.prometheus.exporters.sql.configFile'
|
||||||
'';
|
'';
|
||||||
} ] ++ (flip map (attrNames cfg) (exporter: {
|
} ] ++ (flip map (attrNames exporterOpts) (exporter: {
|
||||||
assertion = cfg.${exporter}.firewallFilter != null -> cfg.${exporter}.openFirewall;
|
assertion = cfg.${exporter}.firewallFilter != null -> cfg.${exporter}.openFirewall;
|
||||||
message = ''
|
message = ''
|
||||||
The `firewallFilter'-option of exporter ${exporter} doesn't have any effect unless
|
The `firewallFilter'-option of exporter ${exporter} doesn't have any effect unless
|
||||||
`openFirewall' is set to `true'!
|
`openFirewall' is set to `true'!
|
||||||
'';
|
'';
|
||||||
}));
|
})) ++ config.services.prometheus.exporters.assertions;
|
||||||
|
warnings = config.services.prometheus.exporters.warnings;
|
||||||
}] ++ [(mkIf config.services.minio.enable {
|
}] ++ [(mkIf config.services.minio.enable {
|
||||||
services.prometheus.exporters.minio.minioAddress = mkDefault "http://localhost:9000";
|
services.prometheus.exporters.minio.minioAddress = mkDefault "http://localhost:9000";
|
||||||
services.prometheus.exporters.minio.minioAccessKey = mkDefault config.services.minio.accessKey;
|
services.prometheus.exporters.minio.minioAccessKey = mkDefault config.services.minio.accessKey;
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
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; };
|
poller = { inherit (cfg.log) debug quiet; };
|
||||||
unifi = { inherit (cfg) controllers; };
|
unifi = { inherit (cfg) controllers; };
|
||||||
influxdb.disable = true;
|
influxdb.disable = true;
|
||||||
|
@ -21,8 +21,8 @@ in {
|
||||||
port = 9130;
|
port = 9130;
|
||||||
|
|
||||||
extraOpts = {
|
extraOpts = {
|
||||||
inherit (options.services.unifi-poller.unifi) controllers;
|
inherit (options.services.unpoller.unifi) controllers;
|
||||||
inherit (options.services.unifi-poller) loki;
|
inherit (options.services.unpoller) loki;
|
||||||
log = {
|
log = {
|
||||||
debug = mkEnableOption (lib.mdDoc "debug logging including line numbers, high resolution timestamps, per-device logs.");
|
debug = mkEnableOption (lib.mdDoc "debug logging including line numbers, high resolution timestamps, per-device logs.");
|
||||||
quiet = mkEnableOption (lib.mdDoc "startup and error logs only.");
|
quiet = mkEnableOption (lib.mdDoc "startup and error logs only.");
|
||||||
|
@ -31,7 +31,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceOpts.serviceConfig = {
|
serviceOpts.serviceConfig = {
|
||||||
ExecStart = "${pkgs.unifi-poller}/bin/unpoller --config ${configFile}";
|
ExecStart = "${pkgs.unpoller}/bin/unpoller --config ${configFile}";
|
||||||
DynamicUser = false;
|
DynamicUser = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1244,15 +1244,15 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
unifi-poller = {
|
unpoller = {
|
||||||
nodeName = "unifi_poller";
|
nodeName = "unpoller";
|
||||||
exporterConfig.enable = true;
|
exporterConfig.enable = true;
|
||||||
exporterConfig.controllers = [{ }];
|
exporterConfig.controllers = [{ }];
|
||||||
exporterTest = ''
|
exporterTest = ''
|
||||||
wait_for_unit("prometheus-unifi-poller-exporter.service")
|
wait_for_unit("prometheus-unpoller-exporter.service")
|
||||||
wait_for_open_port(9130)
|
wait_for_open_port(9130)
|
||||||
succeed(
|
succeed(
|
||||||
"curl -sSf localhost:9130/metrics | grep 'unifipoller_build_info{.\\+} 1'"
|
"curl -sSf localhost:9130/metrics | grep 'unpoller_build_info{.\\+} 1'"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue