Code Files

gwerrors.bat

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


@echo off

TITLE GWERRORS - Parse GW log files for errors, display by time.

if     "%1"==""   goto help
if not "%1"=="/?" goto begin

:help
echo.
echo Program    : GWERRORS - Parse GW log files for errors, display by time.
echo Date       : 24 October 2005
echo Author     : Bob Jonkman
echo. 
echo Usage      : gwerrors agenttype [mmdd [agentname]]
echo. 
echo Parameters : %%1 - Agent type  POA or MTA   (required)
echo              %%2 - Logfile date wildcard; mmdd format (default ???? if omitted)
echo              %%3 - Postoffice Agent (all agents if omitted)
echo.
goto end

Modified        : 6 February 2006 - Substituted generic AGENTTYPE for POA



:begin

if "%1"=="HTMLOnly" goto htmlonly
if "%1"=="XTABOnly" goto xtabonly


rem Verify that %1 is either POA or MTA, otherwise goto help
if     "%1"=="POA" goto setagenttype
if not "%1"=="MTA" goto help


:setagenttype
set AGENTTYPE=%1

set destination=\\cotgw506\sys\apache2\htdocs\stats\gwerrors\


rem set wilddate to %2, or All_Dates if blank or ????
if "%2"=="" goto wilddate
if "%2"=="????" goto wilddate

set wilddate=%2
goto pastwilddate

:wilddate
set wilddate=All_Dates

:pastwilddate


echo Extracting %AGENTTYPE% error messages for %wilddate%...

rem The regex pattern looks for [xxxx]  where x is a hexadecimal digit
call parse%AGENTTYPE% "[[][[:xdigit:]]{4}]" gw%AGENTTYPE%errors.csv %2 %3

echo Sorting errors into timeslots...
gawk -f errorslot.awk gw%AGENTTYPE%errors.csv > gw%AGENTTYPE%errorslot.csv

:xtabonly
echo Creating Crosstab "Timeslot by Agent"...
gawk -f xtab.awk -f library.awk -v XFIELDNUM=1 -v YFIELDNUM=2 gw%AGENTTYPE%errorslot.csv > gw%AGENTTYPE%errors-timeslot-by-agent.csv

echo Creating Crosstab "Errorcode by Agent"...
gawk -f xtab.awk -f library.awk -v XFIELDNUM=1 -v YFIELDNUM=3 gw%AGENTTYPE%errorslot.csv > gw%AGENTTYPE%errors-errorcode-by-agent.csv

echo Creating Crosstab "Timeslot by Errorcode"...
gawk -f xtab.awk -f library.awk -v XFIELDNUM=3 -v YFIELDNUM=2 gw%AGENTTYPE%errorslot.csv > gw%AGENTTYPE%errors-errorcode-by-timeslot.csv


:htmlonly
echo Creating HTML page...
gawk -f csv2html.awk -f library.awk -v TITLE="GW %AGENTTYPE% Error Report for %wilddate% created on %DATE%" -v LINK=1 gw%AGENTTYPE%errors-timeslot-by-agent.csv gw%AGENTTYPE%errors-errorcode-by-agent.csv gw%AGENTTYPE%errors-errorcode-by-timeslot.csv errorcodes.txt > gw%AGENTTYPE%errors.html


echo Publishing HTML files...
copy gw%AGENTTYPE%errors.html                       %destination%
copy gw%AGENTTYPE%errors-timeslot-by-agent.csv      %destination%
copy gw%AGENTTYPE%errors-errorcode-by-agent.csv     %destination%
copy gw%AGENTTYPE%errors-errorcode-by-timeslot.csv  %destination%


echo Preserve data as "gw%AGENTTYPE%errors-*-%wilddate%.csv...

if exist gw%AGENTTYPE%errors-timeslot-by-agent-%wilddate%.csv del gw%AGENTTYPE%errors-timeslot-by-agent-%wilddate%.csv
ren gw%AGENTTYPE%errors-timeslot-by-agent.csv gw%AGENTTYPE%errors-timeslot-by-agent-%wilddate%.csv

if exist gw%AGENTTYPE%errors-errorcode-by-agent-%wilddate%.csv del gw%AGENTTYPE%errors-errorcode-by-agent-%wilddate%.csv
ren gw%AGENTTYPE%errors-errorcode-by-agent.csv gw%AGENTTYPE%errors-errorcode-by-agent-%wilddate%.csv

if exist gw%AGENTTYPE%errors-errorcode-by-timeslot-%wilddate%.csv del gw%AGENTTYPE%errors-errorcode-by-timeslot-%wilddate%.csv
ren gw%AGENTTYPE%errors-errorcode-by-timeslot.csv gw%AGENTTYPE%errors-errorcode-by-timeslot-%wilddate%.csv


:end

rem EOF: gwerrors.BAT

 

   

1 files processed.