diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2021-03-13 19:08:15 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2021-03-13 19:10:03 -0500 |
commit | 44e678f941d62bfc19d27f86456976954c459233 (patch) | |
tree | 63f6d3b8d13288efc8902e4faa9beea88bdcf252 | |
parent | 4b537c81e4ad6e87da9cd5b77b2aec8847346fc7 (diff) |
Set up email alerting in grafana
-rw-r--r-- | machines/dragon.nix | 1 | ||||
-rw-r--r-- | modules/monitoring.nix | 5 | ||||
-rw-r--r-- | modules/postfix.nix | 27 |
3 files changed, 33 insertions, 0 deletions
diff --git a/machines/dragon.nix b/machines/dragon.nix index 2ddd201..d19df25 100644 --- a/machines/dragon.nix +++ b/machines/dragon.nix @@ -21,6 +21,7 @@ in ]; orbekk.monitoring-server.enable = true; + orbekk.postfix.enable = true; environment.systemPackages = with pkgs; [ ipmitool ]; programs.mosh.enable = true; diff --git a/modules/monitoring.nix b/modules/monitoring.nix index 8d154ba..26d0c5d 100644 --- a/modules/monitoring.nix +++ b/modules/monitoring.nix @@ -44,6 +44,11 @@ in domain = cfg.grafana-domain; port = cfg.grafana-port; addr = "127.0.0.1"; + smtp = lib.mkIf config.orbekk.postfix.enable { + enable = true; + host = "localhost:25"; + fromAddress = "root@orbekk.com"; + }; provision = { enable = true; diff --git a/modules/postfix.nix b/modules/postfix.nix new file mode 100644 index 0000000..23f9919 --- /dev/null +++ b/modules/postfix.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.orbekk.postfix; +in +{ + options = { + orbekk.postfix = { + enable = lib.mkEnableOption "Enable postfix config"; + }; + }; + + config = lib.mkIf cfg.enable { + services.postfix = { + enable = true; + hostname = "${config.networking.hostName}.orbekk.com"; + config = { + relayhost = "[smtp.fastmail.com]:465"; + smtp_sasl_auth_enable = true; + smtp_sasl_security_options = "noanonymous"; + smtp_use_tls = true; + smtp_sasl_password_maps = "hash:/opt/secret/postfix-sasl-passwd"; + smtp_tls_wrappermode = "yes"; + smtp_tls_security_level = lib.mkForce "encrypt"; + }; + }; + }; +} |