Victor Villarreal
2017-Feb-20 14:36 UTC
[asterisk-users] Which tool to automatically restart Asterisk ?
Hi, Oliver.
Maybe something like this (add this script to your crontab):
------------------------8<--------------------------
#!/bin/bash
#
# File: asterisk-watchdog.sh
# Date: 2015.05.26
# Build: v1.0
# Brief: Secuencia para monitorizar procesos.
#
# ${PATH}: Variable de entorno con las rutas a los ejecutables.
PATH=/bin:/sbin:/usr/bin:/usr/sbin
# ${DAEMON}: Demonio a monitorizar.
DAEMON="asterisk"
# ${MSG}: Cuerpo del mensaje a enviar por mail.
MSG="$(date '+%F %T'): ${DAEMON} se ha caido!"
pidof ${DAEMON} > /dev/null 2>&1
[ $? -ne 0 ] && { echo ${MSG}; service ${DAEMON} start; }
exit 0
--------------------------->8-----------------------
2017-02-20 11:29 GMT-03:00 Tech Support <asterisk at voipbusiness.us>:
> Hello;
>
> Over time, we?ve built a huge enterprise level monitoring system for
> our internal and customer PBX?s. Using Nagios as the core, along with
> Grafana, Graphite, Carbon, Whisper, etc. so we can also create custom
> dynamic dashboards, we typically monitor over 1,000 different metrics for
> each PBX. For something like monitoring a system process like Asterisk,
> besides just checking to see if the process is running or not, we also
> check about a dozen or so related metrics like memory and cpu usage. If
> anything gets out of whack, the system runs the event handler to restart
> Asterisk. All the plugins are written in Perl, so they?re very easy to
> modify. What I can do if there is an interest is take the Asterisk plugin,
> strip out everything that wouldn?t apply to someone not using our system,
> and make it available to the general public. It's up to you guys. What
do
> you think? Would people find that useful?
>
> Regards;
>
> John V.
>
>
>
> *From:* asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] *On Behalf Of *Olivier
> *Sent:* Friday, February 17, 2017 10:39 AM
> *To:* Asterisk Users Mailing List - Non-Commercial Discussion
> *Subject:* [asterisk-users] Which tool to automatically restart Asterisk ?
>
>
>
> Hello,
>
> Years ago, I used Monit to monitor Asterisk and restart it whenever it
> failed.
>
> Now, I wonder which tool I should pick for an Debian 8 (current) or CentOS
> 7 (future) environment.
>
> The main reason I'm looking for this tool is to avoid as much as
possible,
> current 5 minutes delay between Asterisk's stop and first cutomers
> complains.
>
>
>
> 1. I always install Asterisk from source but I've read in Debian
Stretch
> /etc/defaul/asterisk file, the following:
> # RUNASTSAFE: run safe_asterisk rather than asterisk (will auto-restart
> upon
> # crash). This is generally less tested and has some known
> issues
> # with properly starting and stopping Asterisk.
>
> Where I can read about those known issues ?
>
> (not found in [1]).
>
> 2. For systemd envs where /etc/init.d files are still used, what do you
> recommend ?
>
> 3. For systemd envs where /etc/init.d files are not used anymore, what do
> you recommend ?
>
> 4. Suggestions ?
>
> Regards
>
>
>
> [1] https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg>
asterisk;dist=unstable
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at: https://community.asterisk.
> org/
>
> New to Asterisk? Start here:
> https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
GnuPG Key ID: 0x39BCA9D8
https://www.github.com/mefhigoseth
...:::[ God Rulz ! ]:::...
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20170220/ff270e89/attachment.html>
Tzafrir Cohen
2017-Feb-20 19:28 UTC
[asterisk-users] Which tool to automatically restart Asterisk ?
On Mon, Feb 20, 2017 at 11:36:24AM -0300, Victor Villarreal wrote:> Hi, Oliver. > > Maybe something like this (add this script to your crontab): > > ------------------------8<-------------------------- > > #!/bin/bash > # > # File: asterisk-watchdog.sh > # Date: 2015.05.26 > # Build: v1.0 > # Brief: Secuencia para monitorizar procesos. > # > # ${PATH}: Variable de entorno con las rutas a los ejecutables. > PATH=/bin:/sbin:/usr/bin:/usr/sbin > > # ${DAEMON}: Demonio a monitorizar. > DAEMON="asterisk" > > # ${MSG}: Cuerpo del mensaje a enviar por mail. > MSG="$(date '+%F %T'): ${DAEMON} se ha caido!" > > pidof ${DAEMON} > /dev/null 2>&1 > > [ $? -ne 0 ] && { echo ${MSG}; service ${DAEMON} start; } > > exit 0Both Debian 8 and Centos 7 have systemd. Systemd gives you this type of monitoring almost for free (see previous reply). Using cron is generally not a good idea here: 1. No way to stop Asterisk when you need it. 2. If Asterisk has failed, it may take up to a minute to restart it. -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com
Tahir Almas
2017-Feb-21 13:09 UTC
[asterisk-users] Which tool to automatically restart Asterisk ?
Why not to use Fail2ban https://www.voip-info.org/wiki/view/Fail2Ban+%28with+iptables%29+And+Asterisk *Tahir Almas* Managing Partner ICT Innovations http://www.ictinnovations.com http://www.ictbroadcast.com Leveraging open source in ICT On Tue, Feb 21, 2017 at 12:28 AM, Tzafrir Cohen <tzafrir.cohen at xorcom.com> wrote:> On Mon, Feb 20, 2017 at 11:36:24AM -0300, Victor Villarreal wrote: > > Hi, Oliver. > > > > Maybe something like this (add this script to your crontab): > > > > ------------------------8<-------------------------- > > > > #!/bin/bash > > # > > # File: asterisk-watchdog.sh > > # Date: 2015.05.26 > > # Build: v1.0 > > # Brief: Secuencia para monitorizar procesos. > > # > > # ${PATH}: Variable de entorno con las rutas a los ejecutables. > > PATH=/bin:/sbin:/usr/bin:/usr/sbin > > > > # ${DAEMON}: Demonio a monitorizar. > > DAEMON="asterisk" > > > > # ${MSG}: Cuerpo del mensaje a enviar por mail. > > MSG="$(date '+%F %T'): ${DAEMON} se ha caido!" > > > > pidof ${DAEMON} > /dev/null 2>&1 > > > > [ $? -ne 0 ] && { echo ${MSG}; service ${DAEMON} start; } > > > > exit 0 > > Both Debian 8 and Centos 7 have systemd. Systemd gives you this type of > monitoring almost for free (see previous reply). > > Using cron is generally not a good idea here: > > 1. No way to stop Asterisk when you need it. > > 2. If Asterisk has failed, it may take up to a minute to restart it. > > -- > Tzafrir Cohen > icq#16849755 jabber:tzafrir.cohen at xorcom.com > +972-50-7952406 mailto:tzafrir.cohen at xorcom.com > http://www.xorcom.com > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: https://community.asterisk. > org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20170221/eab700ee/attachment.html>