RECOMMENDATIONS Monitor and auto restart Asterisk?

isaacl

Member
Joined
Sep 22, 2009
Messages
348
Reaction score
3
Any way to have something monitor and auto restart asterisk, in case it stops?
I've seen it stop a few times, and if there is something that can monitor the service and automatically restart it if it goes down, that would be awesome...
Thanks!
 

krzykat

Telecom Strategist
Joined
Aug 2, 2008
Messages
3,145
Reaction score
1,235
I think I'd be putting more of my efforts into finding out why your asterisk stops. That should never happen.
 

isaacl

Member
Joined
Sep 22, 2009
Messages
348
Reaction score
3
I have a server set up that plays music for people who call in, but I've seen it crash or otherwise stop working a few times.
Going to work on figuring out the cause, but for now, it's easiest to just have it restart in case something takes it down.
Going to try monit, thanks @bucasia!
 

isaacl

Member
Joined
Sep 22, 2009
Messages
348
Reaction score
3
Looks like it went down again, but no clue why...
Might be something with the musiconhold setup, but going to try the monit thing for now...
 

isaacl

Member
Joined
Sep 22, 2009
Messages
348
Reaction score
3
Using this code for monit, based on some code I found online with some changes:

Code:
# Asterisk Monitoring rule
set daemon 30 # Check every 30s
set logfile /var/log/monit.log
set alert [email protected] but not on { pid, ppid }
check process asterisk with pidfile /var/run/asterisk/asterisk.pid
group asterisk
start program = "/usr/local/sbin/amportal restart"
stop program = "/usr/local/sbin/amportal kill"
# Check uptime via Asterisk Manager Interface (AMI) port 5038
if failed host 127.0.0.1 port 5038 then restart

I took out the line which has it timeout, and changed the commands to use amportal instead of asterisk.

Anyone have any other input/recommendations?

I saw that @wardmundy was planning on putting together a monit script a while back - did that ever happen?

Thanks a lot!
 
Last edited:
Joined
Feb 13, 2011
Messages
330
Reaction score
12
Using this code for monit, based on some code I found online with some changes:

Code:
# Asterisk Monitoring rule
set daemon 30 # Check every 30s
set logfile /var/log/monit.log
set alert [email protected] but not on { pid, ppid }
check process asterisk with pidfile /var/run/asterisk/asterisk.pid
group asterisk
start program = "/usr/local/sbin/amportal restart"
stop program = "/usr/local/sbin/amportal kill"
# Check uptime via Asterisk Manager Interface (AMI) port 5038
if failed host 127.0.0.1 port 5038 then restart

I took out the line which has it timeout, and changed the commands to use amportal instead of asterisk.

Anyone have any other input/recommendations?

I saw that @wardmundy was planning on putting together a monit script a while back - did that ever happen?

Thanks a lot!


Hi how do you implement this on a PIAF system ?
 

Members online

No members online now.

Forum statistics

Threads
25,812
Messages
167,763
Members
19,241
Latest member
bellabos
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top