zion/modules/monitoring.nix

46 lines
975 B
Nix
Raw Normal View History

2020-09-06 00:39:40 +02:00
{ config, lib, pkgs, ... }:
2022-06-06 23:13:38 +02:00
with pkgs;
2020-09-06 00:39:40 +02:00
{
# Notify when a disk starts going haywire
services.smartd = {
enable = true;
notifications.mail = {
enable = true;
2022-06-06 23:13:38 +02:00
sender = "akasroua+smartd@disroot.org";
recipient = "akasroua@disroot.org";
mailer = "${msmtp}/bin/msmtp -t --read-envelope-from";
};
};
# Notify about zpool problems
services.zfs.zed = {
enableMail = false;
settings = {
ZED_EMAIL_ADDR = "akasroua+smartd@disroot.org";
ZED_EMAIL_PROG = "mail";
ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
ZED_NOTIFY_VERBOSE = false;
2020-09-06 00:39:40 +02:00
};
};
2022-06-06 23:13:38 +02:00
# Set up msmtp as notifier
programs.msmtp = {
2020-09-06 00:39:40 +02:00
enable = true;
2022-06-06 23:13:38 +02:00
defaults = {
port = 587;
tls = true;
};
accounts = {
default = {
auth = true;
host = "disroot.org";
user = "akasroua@disroot.org";
passwordeval = "${coreutils}/bin/cat ${config.age.secrets.msmtp.path}";
};
};
2020-09-06 00:39:40 +02:00
};
2022-06-06 23:13:38 +02:00
2020-09-06 00:39:40 +02:00
}