@echo off
: Gerard O'Rourke
: 24/02/2009
: Version 4.1
set icm-cust-name=icm
set icmPG=2A
set mylogdir=D:\Xtemp
set hour=00
set min=00
:Calcutate DATE
FOR /f "tokens=1-4 delims=/ " %%A IN ('date /t') DO (
set nday=%%A
set nmonth=%%B
set nyear=%%C
)
set SORTDATE=%nyear%%nmonth%%nday%
set begindate=%nmonth%/%nday%/%nyear%
echo Simple ICM Utility to collect PIM, OPC, CTI Server and CTIOS Logs
echo -----------------------------------------------------------------
echo.
set /P begindate=Input the Start Date [mm/dd/yyyy] of the trace file [%begindate%]?
set enddate=%begindate%
set /P enddate=Input the End Date [mm/dd/yyyy] of the trace file [%enddate%]?
set /P hour=Input the Start hour of the trace file [%hour%]?
set /P min=Input what start minute of the trace file [%min%]?
set begintime=%hour%:%min%
set begintime-filename=%hour%-%min%
set /P hour=Input the End hour of the trace file [%hour%]?
set /P min=Input what End minute of the trace file [%min%]?
set endtime=%hour%:%min%
set /P min=Input ICM Customer name [%icm-cust-name%]?
set /P min=Input ICM PG Number-Letter [%icmPG%]?
echo.
set /P min=Input Collection Log Base Directory [%mylogdir%]?
echo.
echo Begin Time: %begintime%. End Time: %endtime%.
echo.
set collect-opc=Y
set collect-pim=Y
set collect-jgw=Y
set collect-cti=Y
set collect-ctios=Y
set /P collect-opc=Collect OPC logs [%collect-opc%]?
set /P collect-pim=Collect PIM logs [%collect-pim%]?
set /P collect-jgw=Collect jgw logs [%collect-jgw%]?
set /P collect-cti=Collect cti logs [%collect-cti%]?
set /P collect-ctios=Collect ctios logs [%collect-ctios%]?
echo.
echo If you are ready to collect logs
pause
echo Collecting Logs...
echo.
if exist %mylogdir%\%sortdate%\ goto CollectLogs
md %mylogdir%\%sortdate%\
:CollectLogs
:OPClogs
IF /I NOT "%collect-opc%"=="Y" goto PIMlogs
echo Collecting OPC logs...
dumplog /dir C:\icm\%icm-cust-name%\pg%icmPG%\logfiles\ opc /bd %begindate% /bt %begintime% /ed %enddate% /et %endtime% /ms /of %mylogdir%\%sortdate%\%sortdate%_opc-%begintime-filename%.txt
:PIMlogs
IF /I NOT "%collect-pim%"=="Y" goto JGW1logs
echo Collecting PIM logs...
dumplog /dir C:\icm\%icm-cust-name%\pg%icmPG%\logfiles\ pim1 /bd %begindate% /bt %begintime% /ed %enddate% /et %endtime% /ms /of %mylogdir%\%sortdate%\%sortdate%_pim-%begintime-filename%.txt
:JGW1logs
IF /I NOT "%collect-jgw%"=="Y" goto CTISVRlogs
echo Collecting JGW1 logs...
dumplog /dir C:\icm\%icm-cust-name%\pg%icmPG%\logfiles\ jgw1 /bd %begindate% /bt %begintime% /ed %enddate% /et %endtime% /ms /of %mylogdir%\%sortdate%\%sortdate%_jgw-%begintime-filename%.txt
:CTISVRlogs
IF /I NOT "%collect-cti%"=="Y" goto CTIOSlogs
echo Collecting CTISVR logs...
dumplog /dir C:\icm\%icm-cust-name%\cg%icmPG%\logfiles ctisvr /bd %begindate% /bt %begintime% /ed %enddate% /et %endtime% /ms /of %mylogdir%\%sortdate%\%sortdate%_ctisvr-%begintime-filename%.txt
:CTIOSlogs
IF /I NOT "%collect-ctios%"=="Y" goto EndLogs
echo Collecting CTIOS logs...
dumplog /dir C:\icm\%icm-cust-name%\CTIOS1\logfiles ctios /bd %begindate% /bt %begintime% /ed %enddate% /et %endtime% /ms /of %mylogdir%\%sortdate%\%sortdate%_ctios-%begintime-filename%.txt
:EndLogs
echo Logs Collected.
pause
explorer %mylogdir%\%sortdate%\