To get the local queue, pipe the output of 'qmqtool -s' through awk.
Code:
lqueue_length=$(qmqtool -s | awk '/local queue/ {print $NF}')
if [ $lqueue_length -gt 100 ]; then
# send mail using mailx or whatever tool you use
# fix the problem in the next three lines
service stop spamd
service stop drwebd
service restart xinet
fi