From 84df834f07f0c10f977a7e4dd71d0ddb526f0161 Mon Sep 17 00:00:00 2001 From: Rico Ullmann Date: Tue, 4 Jan 2022 11:26:39 +0100 Subject: [PATCH] monit: add option to add checks for various services --- bundles/monit/files/monitrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/monit/files/monitrc b/bundles/monit/files/monitrc index b94e503..55ce3f5 100644 --- a/bundles/monit/files/monitrc +++ b/bundles/monit/files/monitrc @@ -43,3 +43,10 @@ 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 + +% for service,options in monit.get('services', {}).items(): +check process ${service} matching "${options['bin']}" + start program = "/bin/systemctl start ${options.get('systemd_unit', 'service')}.service" + stop program = "/bin/systemctl stop ${options.get('systemd_unit', 'service')}.service" + +% endfor