[asterisk-users] asterisk's zombie processes

Skyler skchopperguy at gmail.com
Wed May 18 17:07:05 CDT 2011


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: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] 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       sedwards at sedwards.com      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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110518/0d080d0b/attachment.htm>


More information about the asterisk-users mailing list