Code Files

gwmon-msgdb-size.bat

Generated on Tue Dec 05 17:44:03 Eastern Standard Time 2006 from gwmon-msgdb-size.bat


@echo off
title GWMON-MSGDB-SIZE: Look for large Message DBs, send an alert to gwmon@sobac.com

echo Program: GWMON-MSGDB-SIZE.BAT
echo Purpose: Look for large Message DBs, send an alert to gwmon@sobac.com
echo 	      (large message DB indicates runaway rule)
echo Date	: 15 February 2005
echo Author	: Bob Jonkman [bjonkman@sobac.com]
echo.

rem Modified: 6 February 2006 - Removed Free Space checking (see DISKFREE)

:begin

rem Threshold in MiBytes
set THRESHOLD=1000

echo Threshold=%THRESHOLD% MiBytes

rem DATE variable must be in a filename compatible format!  eg. no slashes, use dashes instead (yyyy-mm-dd)
set outputfile=gwmon-msgdb-size-%date%.csv

echo Output file for MessageDB size is "%outputfile%"

echo Gathering sizes...

set AGENT=COTADM
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cotadm.example.com\mail\cotadm\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNS01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cns01.example.com\cns01\cns01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNS02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cns02.example.com\cns02\cns02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNS03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cns03.example.com\cns03\cns03\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNS04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cns04.example.com\cns04\CNS04\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNS05
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cns05.example.com\cns05\cns05\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=EDC01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\edc01.example.com\edc01\edc01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=EDC02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\edc02.example.com\edc02\edc02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=UPD01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\upd01.example.com\uds01\upd01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=UPD02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\upd02.example.com\uds02\upd02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=GWP01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\gwp01.example.com\cotgwp01\gwp01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=GWP02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\gwp02.example.com\cotgwp02\gwp02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=GWP03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\gwp03.example.com\cotgwp03\gwp03\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=WES01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\wes01.example.com\wes01\wes01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=WES02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\wes02.example.com\wes02\wes02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=WES03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\wes03.example.com\wes03\wes03\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=WES04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\wes04.example.com\wes04\wes04\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=WES05
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\wes05.example.com\wes05\wes05\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNL01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cnl01.example.com\cnl01\CNL01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=COR01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cor01.example.com\cor01\cor01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=COR02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cor02.example.com\cor02\cor02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=COR03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cor03.example.com\cor03\cor03\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=COR04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cor04.example.com\cor04\cor04\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=FIN01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\fin01.example.com\fin01\FIN01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=EXP01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\exp01.example.com\cotexp01\exp01\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=CNL02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\cnl02.example.com\cnl01\cnl02\ofmsg\msg*.db >> %AGENT%.poadir

set AGENT=TRAIN01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%.poadir
dir /-c \\train01.example.com\mail\train01\ofmsg\msg*.db >> %AGENT%.poadir


echo Create list of MSG.DB sizes, generate alert message if THRESHOLD is exceeded...
gawk -f gwmon-msgdb-size.awk -v THRESHOLD=%THRESHOLD% *.poadir > %outputfile%

echo Create Web page of MSG.DB sizes...
gawk -f csv2html.awk -f library.awk -v TITLE="GW Message DB sizes %DATE%  %TIME%" %outputfile% > gwmon-msgdb-size.html

echo Publish Web page...
copy gwmon-msgdb-size.html \\cotgw506\sys\apache2\htdocs\stats\

rem Make sure old alerts are deleted
if exist msgalrt.101 del msgalrt.101

echo Check for threshold violation... (%THRESHOLD%)
gawk -f alert.awk -f library.awk -v THRESHOLD=%THRESHOLD% -v COMP=GT -v FIELDNUM=4 -v TO=gwmon@w01431.corp.example.com -v SUBJECT="GWAlert: MSG.DB exceeds %THRESHOLD% MiBytes" -v ALERTFILE=msgalrt.101 %outputfile% 

if exist msgalrt.101 copy msgalrt.101 c:\mercury\queue

rem Be nice, clean up after yourself...
if exist msgalrt.101 del msgalrt.101

set outputfile=
set AGENT=
set THRESHOLD=

:end


rem EOF: GWMON-MSGDB-SIZE.BAT


   

1 files processed.