bundlewrap/bundles/monit/files/monitrc

45 lines
1.6 KiB
Text

set daemon 30
with start delay 30
set log syslog
set mailserver localhost
set mail-format { from: ${monit['from_address']} }
% for alert_address in monit['alert_addresses']:
set alert ${alert_address}
% endfor
set httpd unixsocket /var/run/monit.sock
use address 127.0.0.1
allow 127.0.0.1
check system $HOST
if cpu usage > 95% for 10 cycles then alert
if memory usage > 80% then alert
if swap usage > 25% then alert
check filesystem rootfs with path /
if space usage > 80% for 5 times within 15 cycles then alert
if space usage > 90% then alert
if inode usage > 90% then alert
check process cron matching "/usr/sbin/cron"
start program = "/usr/bin/systemctl start cron.service"
stop program = "/usr/bin/systemctl stop cron.service"
% for systemd_service in ('systemd-timesyncd', 'systemd-networkd', 'systemd-journald'):
check process ${systemd_service} matching "/lib/systemd/${systemd_service}"
start program = "/usr/bin/systemctl start ${systemd_service}.service"
stop program = "/usr/bin/systemctl stop ${systemd_service}.service"
% endfor
check process sshd matching "/usr/sbin/sshd"
start program = "/bin/systemctl start sshd.service"
stop program = "/bin/systemctl stop sshd.service"
if failed port 22 for 2 cycles then restart
if 3 restarts within 5 cycles then alert
check process postfix matching "/usr/lib/postfix/sbin/master"
start program = "/bin/systemctl start postfix.service"
stop program = "/bin/systemctl stop postfix.service"
if failed port 25 protocol smtp for 5 cycles then restart