I am running Ubuntu 13.04 with the corresponding versions of monit (5.5-6) and asterisk ( 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 my@mail.com
    if match "timed out, trying again \(Attempt " then restart and noalert my@mail.com

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?

  • if after that you issue asterisk start, is the daemon starting right? – Adrian Perez Jun 22 '13 at 10:32
  • Yes, asterisk is running fine afterwards when I start it manually. – j0nes Jun 23 '13 at 9:14

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:

monit -c /path/to/monit.conf -vv -I 2>&1 | tee /tmp/monit_debug.log

Provoke the error and report back what you see.

| improve this answer | |
  • Thanks, this lead to solving this problem. The log output stated that asterisk was still running when monit ran stop and start, so I had to use killall asterisk as a stop command. Since then everything is working fine. – j0nes Jun 24 '13 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.