Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 2 down vote accepted
+50

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.

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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