Code Files

agent-sizes.bat

Generated on Tue Dec 05 17:44:03 Eastern Standard Time 2006 from agent-sizes.bat


@echo off
title AGENT-SIZES: Get GroupWise agent disk stats

echo Program	: AGENT-SIZES.BAT
echo Purpose	: Get GroupWise agent disk stats
echo Date	    : 23 June 2005
echo Author	    : Bob Jonkman [bjonkman@sobac.com]
echo.

rem  Modified   : 5 July 2005 - Clean up PROBLEM files
rem               3 February 2006 - Provide links to .CSV files in HTML page
rem
rem  Note       : %DATE% format must be folder-compliant (eg. no slashes)


:begin
setlocal

if "%1"=="htmlonly" goto createweb

echo Creating PROBLEM queue destination...
set PROBLEMPATH=\\cotgw600\mail\PROBLEM

if exist %PROBLEMPATH% goto pastproblempath

md %PROBLEMPATH%
:pastproblempath

if exist %PROBLEMPATH%\ReadMeFirst.txt goto pastmakereadme

echo File    : PROBLEM folder ReadMe >  %PROBLEMPATH%\ReadMeFirst.txt
echo Date    : 5 July 2005 >> %PROBLEMPATH%\ReadMeFirst.txt
echo Author  : Bob Jonkman [bjonkman@sobac.com] >> %PROBLEMPATH%\ReadMeFirst.txt
echo.  >> %PROBLEMPATH%\ReadMeFirst.txt
echo Note    : \\COTGW600\MAIL\PROBLEM\ >> %PROBLEMPATH%\ReadMeFirst.txt
echo.  >> %PROBLEMPATH%\ReadMeFirst.txt
echo This folder stores messages that are automatically moved from the >> %PROBLEMPATH%\ReadMeFirst.txt
echo PROBLEM queues by the GWMON-Agent-Size task. >> %PROBLEMPATH%\ReadMeFirst.txt
echo. >> %PROBLEMPATH%\ReadMeFirst.txt
echo These files can probably be safely deleted. >> %PROBLEMPATH%\ReadMeFirst.txt
echo. >> %PROBLEMPATH%\ReadMeFirst.txt
echo --Bob. >> %PROBLEMPATH%\ReadMeFirst.txt

:pastmakereadme

set PROBLEMPATH=%PROBLEMPATH%\%DATE%

echo Gathering POA sizes...
set agenttype=POA


set AGENT=COTADM
set AGENTPATH=\\cotadm.example.com\mail\cotadm
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNS01
set AGENTPATH=\\cns01.example.com\cns01\cns01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNS02
set AGENTPATH=\\cns02.example.com\cns02\cns02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNS03
set AGENTPATH=\\cns03.example.com\cns03\cns03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNS04
set AGENTPATH=\\cns04.example.com\cns04\cns04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNS05
set AGENTPATH=\\cns05.example.com\cns05\cns05
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=EDC01
set AGENTPATH=\\edc01.example.com\edc01\edc01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=EDC02
set AGENTPATH=\\edc02.example.com\edc02\edc02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=UPD01
set AGENTPATH=\\upd01.example.com\uds01\upd01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=UPD02
set AGENTPATH=\\upd02.example.com\uds02\upd02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


set AGENT=GWP01
set AGENTPATH=\\gwp01.example.com\cotgwp01\gwp01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=GWP02
set AGENTPATH=\\gwp02.example.com\cotgwp02\gwp02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=GWP03
set AGENTPATH=\\gwp03.example.com\cotgwp03\gwp03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=WES01
set AGENTPATH=\\wes01.example.com\wes01\wes01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=WES02
set AGENTPATH=\\wes02.example.com\wes02\wes02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=WES03
set AGENTPATH=\\wes03.example.com\wes03\wes03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=WES04
set AGENTPATH=\\wes04.example.com\wes04\wes04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

:wes05
set AGENT=WES05
set AGENTPATH=\\wes05.example.com\wes05\wes05
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNL01
set AGENTPATH=\\cnl01.example.com\cnl01\cnl01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COR01
set AGENTPATH=\\COR01.example.com\cor01\cor01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COR02
set AGENTPATH=\\cor02.example.com\cor02\cor02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COR03
set AGENTPATH=\\cor03.example.com\cor03\cor03
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COR04
set AGENTPATH=\\cor04.example.com\cor04\cor04
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=FIN01
set AGENTPATH=\\fin01.example.com\fin01\fin01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=EXP01
set AGENTPATH=\\exp01.example.com\cotexp01\exp01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=CNL02
set AGENTPATH=\\cnl02.example.com\cnl01\cnl02
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


set AGENT=TRAIN01
set AGENTPATH=\\train01.example.com\mail\train01
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


:parsePOA
echo Parsing POA sizes...

gawk -f agent-sizes-poa.awk *-%AGENTTYPE%-dir.txt > agent-sizes-poa.csv


:MTAsize
echo Gathering MTA sizes...
set AGENTTYPE=MTA

set AGENT=COTPRI
set AGENTPATH=\\cotpri.example.com\mail\cotpri
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

rem ##### DEBUG #####
rem goto parsemta

set AGENT=COTGATE
set AGENTPATH=\\cotgate.example.com\mail\cotgate
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COTWEB
set AGENTPATH=\\cotweb.example.com\mail\cotweb
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COTSEC1
set AGENTPATH=\\cotsec1.example.com\mail\cotsec1
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COTSEC2
set AGENTPATH=\\cotsec2.example.com\mail\cotsec2
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COTSEC3
set AGENTPATH=\\cotsec3.example.com\mail\cotsec3
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=COTSECEX
set AGENTPATH=\\cotsecex.example.com\cotexp01\cotsecex
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

set AGENT=GWTRAINPRI
set AGENTPATH=\\gwtrainpri.example.com\mail\gwtrain
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem



:parseMTA
echo Parsing MTA sizes...
gawk -f agent-sizes-mta.awk *-%AGENTTYPE%-dir.txt > agent-sizes-mta.csv




:GATEsize
echo Gathering Gateway sizes...
set AGENTTYPE=GATE

set AGENT=GWAPI
set AGENTPATH=\\cotpri.example.com\mail\cotpri\wpgate\gwapi
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem

rem ##### DEBUG #####
rem goto parsegate

set AGENT=GWIA
set AGENTPATH=\\cotgate.example.com\mail\cotgate\wpgate\gwia
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


set AGENT=GWWEB
set AGENTPATH=\\cotweb.example.com\mail\cotweb\wpgate\gwweb
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


set AGENT=GWIATRAIN
set AGENTPATH=\\gwtrainpri.example.com\mail\gwtrain\wpgate\gwia
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem


set AGENT=TRNWWEB
set AGENTPATH=\\gwtrainpri.example.com\mail\gwtrain\wpgate\trnweb
echo Agent= %AGENT%
echo Agent= %AGENT% > %AGENT%-%AGENTTYPE%-dir.txt
dir /-c /w /s %AGENTPATH% >> %AGENT%-%AGENTTYPE%-dir.txt

call cleanproblem



:parseGATE
echo Parsing Gateway sizes...
gawk -f agent-sizes-gate.awk *-%AGENTTYPE%-dir.txt > agent-sizes-gate.csv


:createweb
echo Creating Web page...
gawk -f csv2html.awk -f library.awk -v LINK=1 -v TITLE="GW Agent Sizes %date%" agent-sizes-*.csv > agent-sizes.html

echo Publishing Web page...
rem ##### DEBUG #####
copy *.html \\cotgw506\sys\apache2\htdocs\stats\
copy agent-sizes-*.csv \\cotgw506\sys\apache2\htdocs\stats\


echo Sending alerts...
if exist agentsiz.101 del agentsiz.101
gawk -f alert.awk -f library.awk -v ALERTFILE=agentsiz.101 -v TO=gwmon@w01431.corp.example.com -v FIELDNAME="PROBLEM Files" -v THRESHOLD=300 -v COMP=GT agent-sizes-*.csv
if exist agentsiz.101 copy agentsiz.101 c:\mercury\queue

rem If no alert then send completion notice to Bob Jonkman's pager
if not exist agentsiz.101 copy bobspager.101 c:\mercury.queue

for %%i in (agent-sizes-*.csv) do ren %%i %date%-%%i

:end
endlocal

rem EOF: AGENT-SIZES.BAT


   

1 files processed.