Broker Queue depth - Unix

Hi,
I’ve a requirement to check the broker queue depth via unix script.
Can anyone please let me know the command/file which can be used to write a script to check broker queue depth.

your response will be highly appreciated.

Many Thanks
Rakesh

#!/usr/bin/ksh
#alert script
b=5000
set -A a 'echo "dis q(*) where(curdepth gt 5000)" | runmqsc QMGR_QM | grep CURDEPTH | cut -c13-16'
set -A c 'echo "dis q(*) where(curdepth gt 5000)" | runmqsc QMGR_QM | grep QUEUE | cut -c10-80 | cut -d ")" -f1
for i in {a[@]} do for j in {c[@]}
do
if [ $i -ge $b ]
then
echo “$j queue depth is $i” | mail -s “Queue depth alert” see@hyatt.com
fi
done
done

Any changes need before running script above apart from email portion?

Also from which location you need to run this script Broker installed location?

Thanks for the utility script posting in the forum:

TIA,
RMG