Settin up NUT client

Hi, I’m trying to configure my NixOS boxes as NUT clients to receive events from my bigger server that is hosting the NUT server. I think I almost got it working but for the life of me cannot figure out how to get it to accept the passwordFile I’m supposed to supply in the config. If I simply have the password inside the file, it complains that it is not a submodule.

Here is the relevant parts of the config:

{ config, pkgs, ... }:

{
  ....
  environment.systemPackages = with pkgs; [
    ...
    nut
  ];

  power.ups = {
    enable = true;
    mode = "netclient";
    upsmon = {
        enable = true;
        monitor = {
            system = "Eaton3S@192.168.1.2";
            user = "upsuser";
            powerValue = 1;
            passwordFile = "/etc/nut/password";
            type = "slave";
       };
    };
  };

and the only contents of the references file is the plain password

1 Like

power.ups.upsmon.monitor supports multiple UPSes, so it’s supposed to be an attribute set with entries named for each UPS you want to monitor. So you maybe want something like monitor.eaton3s = { ... } instead of just monitor = { ... }

Thank you, that was the missing piece. Do you know if there is anything else I need to configure for it to work? It seems to be running now, I just need to do a live test, but wanna make sure it works with like 90% certainty before pulling the plug :smiley:

Looking at my own config for my clients, I don’t see anything there that you’re missing, so I think you’re all set.

Depending on the ups model, plug pulling may not be necessary. Some UPSes support test commands that force battery usage even while the UPS is connected AC.

Here are more examples of client and server code. Battle-tested yesterday by flipping a mislabeled fuse.

Depending on the ups model, plug pulling may not be necessary. Some UPSes support test commands that force battery usage even while the UPS is connected AC.

This is a good point. Some UPS manuals will explicitly tell you to not test via pulling the plug, as it takes away the grounding. Instead, they include a self test feature to be able to test it without disconnecting from the outlet.