10 cfg = config.services.prometheus.exporters.nut;
21 nutServer = mkOption {
23 default = "127.0.0.1";
25 Hostname or address of the NUT server
33 The user to log in into NUT server. If set, passwordPath should
36 Default NUT configs usually permit reading variables without
40 passwordPath = mkOption {
41 type = types.nullOr types.path;
43 apply = final: if final == null then null else toString final;
45 A run-time path to the nutUser password file, which should be
46 provisioned outside of Nix store.
49 nutVariables = mkOption {
50 type = types.listOf types.str;
53 List of NUT variable names to monitor.
55 If no variables are set, all numeric variables will be exported automatically.
56 See the [upstream docs](https://github.com/DRuggeri/nut_exporter?tab=readme-ov-file#variables-and-information)
64 cfg.passwordPath != null
65 ) "export NUT_EXPORTER_PASSWORD=$(cat ${toString cfg.passwordPath})"}
66 ${pkgs.prometheus-nut-exporter}/bin/nut_exporter \
67 --nut.server=${cfg.nutServer} \
68 --web.listen-address="${cfg.listenAddress}:${toString cfg.port}" \
69 ${optionalString (cfg.nutUser != "") "--nut.username=${cfg.nutUser}"} \
72 cfg.nutVariables != [ ]
73 ) "--nut.vars_enable=${concatStringsSep "," cfg.nutVariables}"
75 ${concatStringsSep " " cfg.extraFlags}