j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion
"Re: Monitoring filesizes in Zenoss 4.2"
To view the discussion, visit: http://community.zenoss.org/message/70029#70029
--------------------------------------------------------------
You'll probably have to write a custom script to do this for you. If you're up for modifying one, i have a shell script that i used to use for monitoring IBM MQ queue size on both Windows and UNIX boxes. You'll need to modify it pretty substantially for your use, but the script works against both Windows (via winexe) and Unix (via ssh) boxes. On some 2003 and 2008 servers, the winexe has to be added manually as a service before it will work correctly, which can be done with the following 2 commands (command prompt):
*sc create winexesvc binPath= WINEXESVC.EXE start= auto DisplayName= winexesvc*
*sc description winexesvc "Remote command provider for Zenoss monitoring"*
Additionally, here is the script I mentioned:
*#!/bin/bash*
*###################################*
*#*
*#Â Â Â Â Â Â mq-currqueue.sh*
*#*
*#Â Â Â Â Â Â Â return MQ queue depth for given queue*
*#Â Â Â Â Â Â Â *
*#Â Â Â Â Â Â Â Author:Â Joseph Anderson*
*#Â Â Â Â Â Â Â Version:Â 1.0*
*#Â Â Â Â Â Â Â Released:Â Feb 5, 2009*
*#*
*###################################*
*# input parameters*
*# remote host*
*MQHOST=$1;*
*# OS type ("unix" or "windows")*
*OSTYPE=$2;*
*# queue name*
*QUEUENAME=$3;*
*QUEUEMANAGER=$4;*
*WINRUNMQBIN="runmqsc.exe"*
*RUNMQBIN="/usr/bin/runmqsc"*
*WINEXE="/opt/zenoss/bin/winexe"*
*# if windows, win auth*
*if [[ $OSTYPE = "windows" ]] ; then*
*Â Â Â # like "domain/user%password"*
*Â Â Â WINAUTH=$5;*
*fi*
*###################################*
*#Â Â Â Â Â Â Name: Main*
*#Â Â Â Â Â Â Purpose: Execute Code*
*###################################*
*doMain() {*
*Â Â Â # first check OS type to determine which test to execute*
*Â Â Â if [[ $OSTYPE = "windows" ]] ; then*
*Â Â Â Â Â Â Â queueval=$(checkWinMqQueue $MQHOST "$QUEUENAME" $WINAUTH;)*
*Â Â Â else*
*Â Â Â Â Â Â Â queueval=$(checkMqQueue $MQHOST "$QUEUENAME")*
*   fi   *
*Â Â Â # output queue name, and current depth*
*Â Â Â printf "$QUEUENAME OK|currqueue=$queueval\n"*
*Â Â Â exit 0*
*}*
*###################################*
*#Â Â Â Â Â Â Name: checkMqQueue*
*#Â Â Â Â Â Â Purpose: check MQ Queue*
*###################################*
*checkMqQueue() {*
*Â Â Â MQHOST=$1;*
*Â Â Â QUEUENAME=$2;*
*Â Â Â QUERY=$(cat <<EOD*
*DISPLAY queue($QUEUENAME) TYPE(QLOCAL) CURDEPTH*
*EOD)*
*Â Â Â RMTCMD="su - mqm -c \"echo 'DISPLAY queue(${QUEUENAME}) TYPE(QLOCAL) CURDEPTH' | /usr/bin/runmqsc $QUEUEMANAGER\""*
*Â Â Â RUNCOMMAND=$(sshCommand $MQHOST "$RMTCMD" | grep 'CURDEPTH(' | sed 's/^ *//g' | sed 's/ *$//g' )Â Â Â *
*Â Â Â OUTPUT=$(echo $RUNCOMMANDÂ | awk '{print $2}' | cut -f 2 -d '(' | cut -f 1 -d ')')*
*Â Â Â echo $OUTPUT*
*}*
*###################################*
*#Â Â Â Â Â Â Name: checkWinMqQueue*
*#Â Â Â Â Â Â Purpose: check MQ Queue*
*###################################*
*checkWinMqQueue() {*
*Â Â Â MQHOST=$1;*
*Â Â Â QUEUENAME=$2;*
*Â Â Â WINAUTH=$3;*
*Â Â Â # check queue size*
*Â Â Â QUERY=$(cat <<EOD*
*DISPLAY queue($QUEUENAME) TYPE(QLOCAL) CURDEPTH*
*END*
*EOD)*
*Â Â Â #RUNCOMMAND=$(echo "$QUERY" | winCommand "$MQHOST" "$WINAUTH" "$WINRUNMQBIN $QUEUEMANAGER"| grep 'CURDEPTH(' )*
*Â Â Â RUNCOMMAND=$(echo "$QUERY" | winCommand "$MQHOST" "$WINAUTH" "$WINRUNMQBIN $QUEUEMANAGER"| grep 'CURDEPTH('Â | sed 's/^ *//g' | sed 's/ *$//g' )*
*Â Â Â OUTPUT=$(echo $RUNCOMMANDÂ | awk '{print $1}' | cut -f 2 -d '(' | cut -f 1 -d ')')*
*Â Â Â echo $OUTPUT*
*}*
*###################################*
*#Â Â Â Name: sshCommand*
*#Â Â Â Purpose: execute ssh command*
*###################################*
*sshCommand(){*
*Â Â Â HOST="$1";*
*Â Â Â COMMAND="$2";*
*Â Â Â ssh -q -T root@$HOST "$COMMAND"Â Â Â *
*}*
*###################################*
*#Â Â Â Name: winCommand*
*#Â Â Â Purpose: execute ssh command*
*###################################*
*winCommand(){*
*Â Â Â HOST="$1";*
*   AUTH="$2"; #domain/user%password FOR ZENOSS: ${here/zWinUser}%${here/zWinPassword}*
*Â Â Â COMMAND="$3";*
*Â Â Â $WINEXE -U "$AUTH" //"$HOST" "$COMMAND"*
*}*
*doMain;*
Like I said, this will probably require a bit of work on your side to suit your purposes, but the good thing about it is the ability to run against Windows or Unix via runtime arguments.
Hope this helps,
Joseph
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70029#70029]
Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]