I am running Ubuntu 13.04 with the corresponding versions of monit (5.5-6) and asterisk (22.214.171.124). I have monit set up to watch my asterisk log file for disconnection to my SIP provider and restart asterisk for a new connection. Here is the relevant part of the monit watch script:
check file messages with path "/var/log/asterisk/messages" start program = "/etc/init.d/asterisk start" stop program = "/etc/init.d/asterisk stop" if match "Retransmission timeout reached" then restart and noalert email@example.com if match "timed out, trying again \(Attempt " then restart and noalert firstname.lastname@example.org
The detection of errors is working fine, I get mails when the condition is met. Monit does also stop the asterisk daemon then and the corresponding PID files in /var/run get deleted correctly. However asterisk does not get started again. There is no corresponding error in the monit or asteriks log files.
What is the error in this case? Where can I look for more debugging information?