I am running Ubuntu 13.04 with the corresponding versions of monit (5.5-6) and asterisk (1.8.13.1). 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 protected]
if match "timed out, trying again \(Attempt " then restart and noalert [email protected]
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?
You sometimes need to run monit with highest verbosity in non daemon mode, while you provoke the error (for example echo the strings to monitor for into the log file), to establish what the problem is.
Stop monit and start it with:
Provoke the error and report back what you see.