monit: remove postfix check; sort service items

This commit is contained in:
Rico 2022-01-04 13:15:36 +01:00
parent 2960c1d5d8
commit 917d2b9a2c
Signed by: stillbeben
GPG key ID: AE1066B5BD0B5041

View file

@ -39,19 +39,14 @@ check process sshd matching "/usr/sbin/sshd"
if failed port 22 for 2 cycles then restart if failed port 22 for 2 cycles then restart
if 3 restarts within 5 cycles then alert if 3 restarts within 5 cycles then alert
check process postfix matching "/usr/lib/postfix/sbin/master" % for service,options in sorted(monit.get('services', {}).items()):
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
% for service,options in monit.get('services', {}).items():
check process ${service} matching "${options['bin']}" check process ${service} matching "${options['bin']}"
start program = "/bin/systemctl start ${options.get('systemd_unit', 'service')}.service" start program = "/bin/systemctl start ${options.get('systemd_unit', 'service')}.service"
stop program = "/bin/systemctl stop ${options.get('systemd_unit', 'service')}.service" stop program = "/bin/systemctl stop ${options.get('systemd_unit', 'service')}.service"
% for port,port_options in options.get('ports', {}).items(): % for port,port_options in sorted(options.get('ports', {}).items()):
if failed port ${port} protocol ${port_options['protocol']} for ${port_options.get('cycles', '5')} cycles then restart if failed port ${port} protocol ${port_options['protocol']} for ${port_options.get('cycles', '5')} cycles then restart
% endfor % endfor
% for domain,http_options in options.get('http', {}).items(): % for domain,http_options in sorted(options.get('http', {}).items()):
if failed host ${domain} if failed host ${domain}
% if http_options['scheme'] == 'https': % if http_options['scheme'] == 'https':
port 443 port 443