forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prometheus-unifi-poller-exporter: init module
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ let | |
"surfboard" | ||
"tor" | ||
"unifi" | ||
"unifi-poller" | ||
"varnish" | ||
"wireguard" | ||
] (name: | ||
|
34 changes: 34 additions & 0 deletions
34
nixos/modules/services/monitoring/prometheus/exporters/unifi-poller.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ config, lib, pkgs, options }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.services.prometheus.exporters.unifi-poller; | ||
|
||
configFile = pkgs.writeText "prometheus-unifi-poller-exporter.json" (generators.toJSON {} { | ||
poller = { inherit (cfg.log) debug quiet; }; | ||
unifi = { inherit (cfg) controllers; }; | ||
influxdb.disable = true; | ||
prometheus = { | ||
http_listen = "${cfg.listenAddress}:${toString cfg.port}"; | ||
report_errors = cfg.log.prometheusErrors; | ||
}; | ||
}); | ||
|
||
in { | ||
port = 9130; | ||
|
||
extraOpts = { | ||
inherit (options.services.unifi-poller.unifi) controllers; | ||
log = { | ||
debug = mkEnableOption "debug logging including line numbers, high resolution timestamps, per-device logs."; | ||
quiet = mkEnableOption "startup and error logs only."; | ||
prometheusErrors = mkEnableOption "emitting errors to prometheus."; | ||
}; | ||
}; | ||
|
||
serviceOpts.serviceConfig = { | ||
ExecStart = "${pkgs.unifi-poller}/bin/unifi-poller --config ${configFile}"; | ||
DynamicUser = false; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters