diff options
Diffstat (limited to 'modules/monit.nix')
| -rw-r--r-- | modules/monit.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/modules/monit.nix b/modules/monit.nix new file mode 100644 index 0000000..b4155ee --- /dev/null +++ b/modules/monit.nix @@ -0,0 +1,42 @@ +{ pkgs, libs, config, ... }: +{ + + services.monit = { + enable = true; + config = '' + set mailserver localhost port 25 username admin + set alert mail@krinitsin.com + + set daemon 120 with start delay 60 + set mailserver + localhost + + set httpd port 2812 and use address localhost + allow localhost + + check filesystem root with path / + if space usage > 80% then alert + if inode usage > 80% then alert + + check system $HOST + if cpu usage > 95% for 10 cycles then alert + if memory usage > 75% for 5 cycles then alert + if swap usage > 20% for 10 cycles then alert + if loadavg (1min) > 90 for 15 cycles then alert + if loadavg (5min) > 80 for 10 cycles then alert + if loadavg (15min) > 70 for 8 cycles then alert + + check network network interface ens3 + ''; + }; + + services.nginx.virtualHosts."status.krinitsin.com" = { + forceSSL = true; + useACMEHost = "krinitsin.com"; + basicAuthFile = "/secret/monit"; + locations."/".proxyPass = "http://localhost:2812"; + }; + + security.acme.certs."krinitsin.com".extraDomainNames = [ "status.krinitsin.com" ]; + +} |