Hi,

 

 You can run the script below as an hourly cron. Works for me.

 

 

#!/bin/sh

#       clean-up Asterisk zombies

#       file clean_up.sh

#       $Id: clean_up all dead parent processes

#       use as cron task */30 * * * * root /usr/local/sbin/clean_up.sh

#########

 

##LOG=/var/log/asterisk/agi-cleanup.log

date=`date +%d-%m-%Y_%Hh%Mm`

 

t1=`cat /proc/stat | grep btime | awk '{print $2}'`

t3=`date +%s`

 

echo "$date - Asterisk Zombies Clean up started....." ####  >> $LOG

echo ""

 

for parent in `ps -ef | grep safe_asterisk | awk '$3 == '1'{print $2}'`

do

for ppid in `ps -ef | awk '$3 == '${parent}' { print $2 }'`

do

for i in `ps -ef | awk '$3 == '${ppid}' { print $2 }'`

do

 

t2=`cat /proc/$i/stat| awk '{print $22}'`

b=$(($t3-$t1));

c=$(($t2/100));

d=$((($b-$c)/60));

 

if [ $d -gt 30 ] ; then

kill -9 $i

echo "Zombie found - killing $i" ### >> $LOG

fi

 

done

done

done

 

exit

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Steve Edwards
Sent: Wednesday, May 18, 2011 1:48 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] asterisk's zombie processes

 

On Wed, 18 May 2011, vip killa wrote:

> I'm monitoring Asterisk with Nagios. Nagios constantly alerts because of
> too many zombie processes. I eventually had to disable the notification
> for the alert but why does Asterisk create so many zombie processes,
> I've see more than 30 at times and it generally stays in the 20s... just
> seems unusual and wondering if it's harmful, thanks in advance. 

Asterisk creates threads, not processes.

Trace back from the PPID of the zombies to see who created them

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       [email protected]      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000 

  _____  

No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1325 / Virus Database: 1509/3645 - Release Date: 05/18/11

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to