[asterisk-users] Asterisk 13 High CPU usage

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Jul 25 06:21:14 CDT 2016


On Sun, Jul 24, 2016 at 06:39:19PM +0100, ian gilmour wrote:
> The following bash 1-liner may be useful...
> 
> while true; do top -Hbc -p `pgrep asterisk` -n 1 && asterisk -rx "core show
> threads"; sleep 1; done

Just for the kicks:

ps --no-headers -L -o lwp,cp --sort lwp `pidof asterisk` \
| join -1 1 -2 2 - <(asterisk -rx 'core show threads' | sort -k2) \
| sort -n -k 2

Notes:
1. Bashism. <(...) requires bash.
2. Join counts on a non-numeric sort. Maybe there's an extrs sort needed
   for ps, as I guess it sorts numerically.
3. I tried puting this all in watch: watch -n1 -d '...' or 
   watch -n1 -d bash -c "...", but I got an error message:
   "sh: 1: Syntax error: "(" unexpected"

(sh? shouldn't it be bash?)

But at this point I have already exceeded the allocated time slot.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com



More information about the asterisk-users mailing list