Notify of SMART errors via email

This commit is contained in:
coolneng 2022-05-02 05:47:52 +02:00
parent cbe77015ba
commit 24881e6195
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
4 changed files with 44 additions and 0 deletions

View File

@ -101,6 +101,7 @@ in {
secrets.wireguard.file = secrets/wireguard.age; secrets.wireguard.file = secrets/wireguard.age;
secrets.syncthing.file = secrets/syncthing.age; secrets.syncthing.file = secrets/syncthing.age;
secrets.samba-ugent.file = secrets/samba-ugent.age; secrets.samba-ugent.file = secrets/samba-ugent.age;
secrets.msmtp.file = secrets/msmtp.age;
identityPaths = [ "/etc/ssh/id_ed25519" ]; identityPaths = [ "/etc/ssh/id_ed25519" ];
}; };
@ -159,6 +160,7 @@ in {
./modules/printing.nix ./modules/printing.nix
./modules/periodic.nix ./modules/periodic.nix
./modules/power.nix ./modules/power.nix
./modules/monitoring.nix
./overlays/nix-direnv.nix ./overlays/nix-direnv.nix
./overlays/openconnect-sso.nix ./overlays/openconnect-sso.nix
./overlays/cyrus-sasl-oauth2.nix ./overlays/cyrus-sasl-oauth2.nix

33
modules/monitoring.nix Normal file
View File

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
# Notify when a disk starts going haywire
services.smartd = {
enable = true;
notifications.mail = {
enable = true;
sender = "akasroua+smartd@disroot.org";
recipient = "akasroua@disroot.org";
mailer = "${pkgs.msmtp}/bin/msmtp -t --read-envelope-from";
};
};
# Set up msmtp as notifier
programs.msmtp = {
enable = true;
defaults = {
port = 587;
tls = true;
};
accounts = {
default = {
auth = true;
host = "disroot.org";
user = "akasroua@disroot.org";
passwordeval =
"${pkgs.coreutils}/bin/cat ${config.age.secrets.msmtp.path}";
};
};
};
}

8
secrets/msmtp.age Normal file
View File

@ -0,0 +1,8 @@
age-encryption.org/v1
-> ssh-ed25519 G5UUhw yZ6q0+opG1dPd+bziS6EK4Da2R1HI4SN5CNZTFR0NFI
xx6fet9CzAuWdwEzQrR7qc6DJZDPUM+Ug995OHJnO+w
-> -ENU/-grease sB@d>Z >aJ<En""
rUSbcqOSzKWJRomQ8uqM0L1wq1OeKtmbAXRtDhisJcSIg82+eIF2jwf8Id7tMEyk
KrTfLHN7Ts9b/duzBrM9FDqm6pE9DqxUp652Tyo9ENa/
--- 07ccdiEaTyEPofLC2xPqYeF3lkMMFiAM2g1MKqv2pwc
ðÛ+4³/ǃTRÙ ¸§ym¢*Öp×Þ~ÿ¢ EÅg5vºÊ½ï•œêPn'µƒiÎÐ><3E>»°^$RðPºÃzSà!<´<>š¥>²è<1F>#ç˜ÏžýýhúéÀ

View File

@ -5,4 +5,5 @@ in {
"wireguard.age".publicKeys = [ coolneng ]; "wireguard.age".publicKeys = [ coolneng ];
"syncthing.age".publicKeys = [ coolneng ]; "syncthing.age".publicKeys = [ coolneng ];
"samba-ugent.age".publicKeys = [ coolneng ]; "samba-ugent.age".publicKeys = [ coolneng ];
"msmtp.age".publicKeys = [ coolneng ];
} }