forked from DGNum/infrastructure
style: requested change
This commit is contained in:
parent
4d16839a10
commit
1eea46b59f
1 changed files with 16 additions and 12 deletions
|
@ -1,18 +1,23 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
power.ups = {
|
||||
enable = true;
|
||||
ups."eaton" = {
|
||||
ups.eaton = {
|
||||
driver = "usbhid-ups";
|
||||
port = "auto";
|
||||
};
|
||||
upsmon.enable = false;
|
||||
users."eatonMon" = {
|
||||
users.eatonmon = {
|
||||
passwordFile = config.age.secrets."eatonmon-password_file".path;
|
||||
upsmon = "primary";
|
||||
};
|
||||
upsmon.monitor."eaton" = {
|
||||
user = "eatonMon";
|
||||
upsmon.monitor.eaton = {
|
||||
user = "eatonmon";
|
||||
};
|
||||
schedulerRules =
|
||||
let
|
||||
|
@ -32,7 +37,7 @@
|
|||
*) MEANING="Signal unknown, check configuration.";;
|
||||
esac
|
||||
sendmail -i -t <<ERRMAIL
|
||||
To: fai@dgnum.eu
|
||||
To: fai+monitoring@dgnum.eu
|
||||
Subject: [$HOSTNAME] Battery signal: $1
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
|
@ -45,8 +50,11 @@
|
|||
esac
|
||||
'';
|
||||
};
|
||||
rules = ''
|
||||
CMDSCRIPT ${cmdScript}/bin/upssched-cmd.sh
|
||||
in
|
||||
(pkgs.writeTextFile {
|
||||
name = "upssched.conf";
|
||||
text = ''
|
||||
CMDSCRIPT ${lib.getExe cmdScript}
|
||||
PIPEFN /var/state/ups/upssched/upssched.pipe
|
||||
LOCKFN /var/state/ups/upssched/upssched.lock
|
||||
AT LOWBATT * EXECUTE shutdown-low
|
||||
|
@ -57,10 +65,6 @@
|
|||
AT NOCOMM * EXECUTE warn-comm
|
||||
AT BYPASS * EXECUTE warn-bypass
|
||||
'';
|
||||
in
|
||||
(pkgs.writeTextFile {
|
||||
name = "upssched.conf";
|
||||
text = rules;
|
||||
}).outPath;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue