feat(monitoring): Add admin emails
All checks were successful
build configuration / build_web02 (push) Successful in 1m16s
build configuration / build_rescue01 (push) Successful in 1m21s
build configuration / build_vault01 (push) Successful in 1m21s
build configuration / build_storage01 (push) Successful in 1m22s
build configuration / build_compute01 (push) Successful in 1m28s
lint / check (push) Successful in 23s
build configuration / build_web01 (push) Successful in 1m45s
build configuration / push_to_cache (push) Successful in 2m13s
All checks were successful
build configuration / build_web02 (push) Successful in 1m16s
build configuration / build_rescue01 (push) Successful in 1m21s
build configuration / build_vault01 (push) Successful in 1m21s
build configuration / build_storage01 (push) Successful in 1m22s
build configuration / build_compute01 (push) Successful in 1m28s
lint / check (push) Successful in 23s
build configuration / build_web01 (push) Successful in 1m45s
build configuration / push_to_cache (push) Successful in 2m13s
This commit is contained in:
parent
b732c5e9fb
commit
a63f682aeb
1 changed files with 24 additions and 4 deletions
|
@ -2,17 +2,36 @@
|
||||||
config,
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
|
meta,
|
||||||
|
nodeMeta,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
concatStringsSep
|
||||||
|
mkEnableOption
|
||||||
|
mkForce
|
||||||
|
mkIf
|
||||||
|
;
|
||||||
|
|
||||||
|
emails = concatStringsSep ", " (
|
||||||
|
builtins.map (name: meta.organization.members.${name}.email) nodeMeta.admins
|
||||||
|
);
|
||||||
|
|
||||||
|
cfg = config.dgn-notify;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
options.dgn-notify = {
|
options.dgn-notify = {
|
||||||
enable = lib.mkEnableOption "DGNum email notification cli" // {
|
enable = mkEnableOption "DGNum email notification cli" // {
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf config.dgn-notify.enable {
|
|
||||||
services.mail.sendmailSetuidWrapper.group = lib.mkForce "mail";
|
config = mkIf cfg.enable {
|
||||||
|
services.mail.sendmailSetuidWrapper.group = mkForce "mail";
|
||||||
users.groups.mail = { };
|
users.groups.mail = { };
|
||||||
|
|
||||||
programs.msmtp = {
|
programs.msmtp = {
|
||||||
|
@ -29,12 +48,13 @@
|
||||||
passwordeval = "cat ${config.age.secrets.mail.path}";
|
passwordeval = "cat ${config.age.secrets.mail.path}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.systemd-notify = {
|
services.systemd-notify = {
|
||||||
enable = true;
|
enable = true;
|
||||||
command = builtins.toString (
|
command = builtins.toString (
|
||||||
pkgs.writeShellScript "sendmail" ''
|
pkgs.writeShellScript "sendmail" ''
|
||||||
${pkgs.msmtp}/bin/sendmail -i -t <<ERRMAIL
|
${pkgs.msmtp}/bin/sendmail -i -t <<ERRMAIL
|
||||||
To: admins+monitoring@dgnum.eu
|
To: admins+monitoring@dgnum.eu, ${emails}
|
||||||
Subject: [$HOSTNAME] Systemd failure: $1
|
Subject: [$HOSTNAME] Systemd failure: $1
|
||||||
Content-Transfer-Encoding: 8bit
|
Content-Transfer-Encoding: 8bit
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
Loading…
Reference in a new issue