finally fixing the ups, plus tons of formatting
This commit is contained in:
@@ -1,59 +1,46 @@
|
||||
{
|
||||
inputs,
|
||||
outputs,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ config, ... }:
|
||||
let
|
||||
enableUps = true;
|
||||
upsmonCmd = "nasups@localhost 1 upsuser BogieDudie1 primary";
|
||||
upsName = "nasups";
|
||||
upsName = "nas-ups";
|
||||
upsUser = "nas-admin";
|
||||
in
|
||||
{
|
||||
power.ups = {
|
||||
enable = enableUps;
|
||||
openFirewall = enableUps;
|
||||
mode = "netserver";
|
||||
|
||||
ups = {
|
||||
enable = enableUps;
|
||||
mode = "netserver";
|
||||
ups.upsName = {
|
||||
"${upsName}" = {
|
||||
description = "NAS UPS";
|
||||
driver = "usbhid-ups";
|
||||
port = "auto";
|
||||
description = "NAS UPS";
|
||||
};
|
||||
upsmon = {
|
||||
monitor = upsmonCmd;
|
||||
};
|
||||
upsd = {
|
||||
enable = enableUps;
|
||||
listen = {
|
||||
address = 0.0 0.0 0.0;
|
||||
port = 3493;
|
||||
};
|
||||
};
|
||||
# users = {
|
||||
# actions = [ "SET" ];
|
||||
# instcmds = [ "ALL" ];
|
||||
##* upsmon = "primary";
|
||||
# passwordFile = "/home/matt/ups.conf";
|
||||
# };
|
||||
};
|
||||
|
||||
# Add UPS monitoring service
|
||||
users."${upsUser}" = {
|
||||
passwordFile = config.sops.secrets."jallen-nas/ups_password".path;
|
||||
actions = [ "ALL" ];
|
||||
instcmds = [ "ALL" ];
|
||||
upsmon = "primary";
|
||||
};
|
||||
|
||||
upsmon = {
|
||||
enable = true;
|
||||
# Configure UPS device
|
||||
device = "/dev/usb/hiddev1"; # Change this to your UPS device
|
||||
driver = "usbhid-ups"; # Change this if your UPS uses a different driver
|
||||
# Set UPS monitoring options
|
||||
options = {
|
||||
# NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
|
||||
POLLFREQ = 5;
|
||||
POLLFREQALERT = 5;
|
||||
HOSTSYNC = "on";
|
||||
DEADTIME = 15;
|
||||
FINALDELAY = 5;
|
||||
enable = enableUps;
|
||||
monitor."${upsName}" = {
|
||||
passwordFile = config.sops.secrets."jallen-nas/ups_password".path;
|
||||
user = upsUser;
|
||||
};
|
||||
};
|
||||
|
||||
upsd = {
|
||||
enable = enableUps;
|
||||
listen = [
|
||||
{
|
||||
address = "0.0.0.0";
|
||||
port = 3493;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user