[Asterisk-Users] Polling Asterisk for Life

Joseph Tanner joseph at thetechguide.com
Thu Mar 2 14:12:05 MST 2006


The problem isn't that asterisk isn't running, it's that asterisk is
not responding.  When asterisk is in this funky state, I can still run
"asterisk -vvvvr" from the command line and get access to the CLI. 
While in the CLI, the only command that asterisk will respond to is
"exit" which drops me back to the shell.  If I try to issue a "stop
now", asterisk just immediately returns to the CLI> prompt.  It does
this for every single command, except for "exit".

So, simply respawning asterisk, or checking to see if it's running
isn't good enough, because asterisk is indeed running.  We need to
access asterisk and issue a command, and see if asterisk responds
appropriately.  If not, we can assume it has died, and we can kill it
off (killall -9 asterisk) and then start it back up again (or reboot
the whole server if necessary).

Yes, it's an odd problem, but I've noticed it so I can confirm it is a
state asterisk can get into, and can confirm its symptoms.  Hopefully
all that is over with now after I upgraded (also fyi, I also moved my
x101p around so it'd get its own irq, so it's possible that was the
problem, though I doubt it).  If it turns out I still have the
problem, I'll probably whip up a script to check asterisk's condition
and restart if needed.

Joseph Tanner

On 3/2/06, David Cook <dbc_asterisk at advan.ca> wrote:
> Obviously if Asterisk keeps going down there is another problem to be
> found. However, why not start it from /etc/inittab with respawn??? Else,
> poll from cron or a script with ps ax | grep asterisk | grep -v grep |
> wc -l to find out if it is running. dbc. Date: Thu, 2 Mar 2006 22:01:01
> +0200 From: "Cosmin Prund" <cosmin at adicomsoft.ro> Subject: RE:
> [Asterisk-Users] Polling Asterisk for Life To: "'Asterisk Users Mailing
> List - Non-Commercial Discussion'" <asterisk-users at lists.digium.com>
> Message-ID: <026301c63e34$08d7a6d0$a3512356 at adicomsoft> Content-Type:
> text/plain; charset="us-ascii" AFAIK there are problems with repeatedly
> connecting and disconnecting the manager interface. Also you're probably
> using a proxy (all "manager" interfaces I've seen are using proxies), it
> might not be a good idea to pool something out of the manager that
> often. Did you consider running a "cron" job on the server, using
> "asterisk -rx" to run a command and then decide rather asterisk is down
> or not based on the result? This way you'd be doing on the server,
> working around the problems with the manager interface and saving some
> bandwidth :) . You might also be able to call /sbin/reboot directly from
> the cron script! If on the other hand the whole server is going down you
> may simply use ping!
>
> > > -----Original Message-----
> > > From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> > > bounces at lists.digium.com] On Behalf Of Matt
> > > Sent: Thursday, March 02, 2006 7:47 PM
> > > To: Asterisk Users Mailing List - Non-Commercial Discussion
> > > Subject: [Asterisk-Users] Polling Asterisk for Life
> > >
> > > Hi,
> > > Occassionally Asterisk will go down and I have to restart it.. not
> > > often.. but sometimes.  When it does the manager interface stops
> > > working, as does the CLI.
> > >
> > > My thoughts was to poll the manager interface once every 5 minutes for
> > > a value.  If I don't get the value back then alert me that the server
> > > is possibly down.
> > >
> > > Does anyone know what a good value to poll for might be?   I was
> > > thinking I could poll my SIP account for the CallWaiting value, but
> > > would like something that was not linked to my account.
> > >
> > > Just something that returns a single line is fine.
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list