For anybody who whats to see my (I use the term 'my' very loosely since it 
really came from tseward and I just tweaked it a very little bit) final script. 
 It is below.
This monitors the queue you tell it on the machine you tell it.


Code:

#!/bin/sh
#
# $1 domain/username
# $2 password
# $3 server
# $4 queue name
#

RAW=$(wmic --namespace='root\MicrosoftExchangeV2' -U $1%$2 //$3 "SELECT 
MessageCount From Exchange_SMTPQueue Where QueueName='$4'")

ERROR=`echo $RAW | cut -f2- -d\ | tr ' ' '\n' | grep 'ERROR' | cut -f1 -d: | 
head -1`

if [ "$ERROR" != "ERROR" ]
then
RESULT=`echo $RAW | cut -d \|  -f 10`
RESULT=`echo $RESULT | cut -d \|  -f 1`
echo -n $RESULT | awk '{print "OK|Items=" $1}'
else
echo -n $RAW | awk '{print $RAW}'
fi





The Command Template in Zenoss is 
 

Code:

$$ZENHOME/libexec/check_exchange_mailq.sh '${dev/zWinUser}' 
'${dev/zWinPassword}' SERVER_NAME QUEUE_NAME




Occasionally I will see a slight difference (one message) between what this 
reports and what the System Manager reports but I chalk that up to the 
distinction between links and queues that WMI has but System Manager does not.

The one change I would like to make would be to have the script get the machine 
name from Zenoss i.e. if the template is on a machine called exchange99 the 
SERVER_NAME should be automatically populated with that name.  This would allow 
you to use the script on a global exchange template without having to 
necessarily tweak it for each box.  However, I only have a small handful of 
exchange boxes so it is not a big deal.

Thanks again tseward!

James[/code][/quote]




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=12920#12920

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to