0

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 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?

j0nes
  • 945
  • 10
  • 25

1 Answers1

3

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.

3molo
  • 4,340
  • 5
  • 30
  • 46
  • 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