Notify of SMART errors via email

This commit is contained in:
2022-05-02 05:47:52 +02:00
parent cbe77015ba
commit 24881e6195
4 changed files with 44 additions and 0 deletions

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}";
};
};
};
}