Skip to content

Commit

Permalink
deskapp: ups monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
appaquet committed Oct 17, 2024
1 parent def425a commit 9589700
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nixos/deskapp/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
../network_bridge.nix
../dev.nix
../docker.nix
../ups.nix
];

# Bootloader.
Expand Down
50 changes: 50 additions & 0 deletions nixos/ups.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ pkgs, secrets, ... }:

{
#MONITOR ups@192.168.2.90 1 monuser secret slave # not so secrets... default for synology
#MINSUPPLIES 1 # Minimum number of power supplies
#SHUTDOWNCMD "/sbin/shutdown -h +0"
#POLLFREQ 5 # Poll every 5 seconds
#POLLFREQALERT 5 # Same as POLLFREQ
#HOSTSYNC 15 # Sync with UPS every 15 minutes
#DEADTIME 15 # UPS is dead after 15 minutes
#POWERDOWNFLAG /etc/killpower # File to touch to shutdown the system
#NOTIFYFLAG COMMOK SYSLOG # Don't notify when we go back to power
#NOTIFYFLAG COMMBAD SYSLOG
#NOTIFYFLAG NOCOMM SYSLOG # Notify when we lose communications
#NOTIFYFLAG NOPARENT SYSLOG
#RBWARNTIME 43200
#NOCOMMWARNTIME 300
#FINALDELAY 5

power.ups = {
enable = true;
mode = "netclient";

users.monuser = {
upsmon = "primary";
passwordFile = secrets.deskapp.nasappUpsPw;
};

upsmon = {
settings = {
MINSUPPLIES = 1; # Minimum number of power supplies
SHUTDOWNCMD = "${pkgs.systemd}/bin/shutdown now";

# Don't spam WALL
NOTIFYFLAG = [
[ "COMMOK" "SYSLOG" ]
[ "COMMBAD" "SYSLOG" ]
[ "NOCOMM" "SYSLOG" ]
[ "NOPARENT" "SYSLOG" ]
];
};

monitor.main = {
system = "ups@192.168.0.20";
user = "monuser";
passwordFile = secrets.deskapp.nasappUpsPw;
};
};
};
}
2 changes: 1 addition & 1 deletion secrets

0 comments on commit 9589700

Please sign in to comment.