Hello Tildeslash, I try to send status notifications to a central system, this works well all the time an application stopped by an failure or get some problems.
But all the time I use "monit stop" to stop an application I got no notification, the script will not called by Monit. I used the following process definition in my test environment (with monit 5.25.1 and monit 5.21.0). check process wait.sh matching "sleep" start program = "/Users/lutz/Aufheben/monit/scripts/wait.sh" stop program = "/Users/lutz/Aufheben/monit/scripts/wait.sh" restart program = "/Users/lutz/Aufheben/monit/scripts/wait.sh" if cpu usage > 55% for 10 cycles then stop if not exist then restart if not exist then exec "/Users/lutz/Aufheben/monit/scripts/zexec.sh" else if succeeded then exec "/Users/lutz/Aufheben/monit/scripts/zexec.sh" The script "zexec.sh" is the notification script I used to send information to a central system (the central system send SMS or mail notifications). wait.sh │ Does not exist │ Process : [CEST Jun 16 11:05:34] error : 'wait.sh' process is not running [CEST Jun 16 11:05:34] info : 'wait.sh' exec: '/Users/lutz/Aufheben/monit/scripts/zexec.sh' [CEST Jun 16 11:05:34] error : 'wait.sh' process is not running [CEST Jun 16 11:05:34] info : 'wait.sh' trying to restart [CEST Jun 16 11:05:34] info : 'wait.sh' restart: '/Users/lutz/Aufheben/monit/scripts/wait.sh' : [CEST Jun 16 11:06:36] info : 'wait.sh' process is running with pid 14501 [CEST Jun 16 11:06:36] info : 'wait.sh' exec: '/Users/lutz/Aufheben/monit/scripts/zexec.sh' [CEST Jun 16 11:06:36] info : 'wait.sh' process is running with pid 14501 : wait.sh │ OK │ Process All the time a problem was recovery by Monit the notification script was called. wait.sh │ OK │ Process monit stop wait.sh : [CEST Jun 16 11:06:59] info : 'wait.sh' stop on user request [CEST Jun 16 11:07:06] info : 'wait.sh' stop: '/Users/lutz/Aufheben/monit/scripts/wait.sh' [CEST Jun 16 11:07:37] error : 'wait.sh' failed to stop (exit status 0) -- no output [CEST Jun 16 11:07:37] info : 'wait.sh' stop action failed : wait.sh │ Not monitored │ Process monit start wait.sh : [CEST Jun 16 11:08:32] info : 'wait.sh' start on user request [CEST Jun 16 11:08:32] info : 'wait.sh' start: '/Users/lutz/Aufheben/monit/scripts/wait.sh' [CEST Jun 16 11:08:32] info : 'wait.sh' start action done : wait.sh │ OK │ Process But all the time I restart the application via Monit, the notification script was not called. I try to use someting like this as well. if changed pid then exec exec "/Users/lutz/Aufheben/monit/scripts/zexec.sh" But get a notification on pid changes only, if the pid disappear, no notifications send. Any idea how to get a status notification all the time, send by Monit itself (or via M/Monit). Thanks for any suggestion, Lutz -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general