Genesys Health Check Part One-SCS/SCI
Every morning, we check SCI to make sure that all our applications are running, and that they haven’t failed over for some unexplained reason. Unfortunately there are a lot of applications to check, an this gets a bit tedious. We’ve had several times where the person responsible for checking missed the fact that an application had failed.
So I wrote the following script to check current status of the applications against a list of “preferred states”. The biggest challenge I faced was that it isn’t particularly easy to get the current state of an application directly from the SCS logs. The only way I found: after someone logs into SCI, the SCS logs report a complete status check for all applications. So, support person must first login to SCI, then launch this script to check the logs against the preferred states list. In order to make use of this in your organization, you’ll need to set the LOG and APP variables. All the mentions of “CTS” in the script are references to one of our two Genesys environments. You can remove or change CTS to suite your implementation.
@echo off
set NORMAL=cts-status-normal.txt
set result=%temp%\cts-status-check.txt
set LOG=\\wpoh0010genwf01\Logs\cts_dub_scs_prset APP=ctssci
echo For this utility to work proprerly, you must have logged in to SCI recently, and cts_dub_SCS_pr must be PRIMARY.
echo If you have not done so, please log in to SCI now.
echo.
pause:begin_here
if exist %result% del %result%
set FILE=%1
if .%FILE%.==.. (
rem if a file wasn’t passed in, see if we can find one
for /f %%k in (’dir /b /on %LOG%’) do set FILE=%LOG%\%%k
)
echo Checking %FILE%
copy /y “%FILE%” %TEMP%\cts-status-log.log
set BAD=false
echo Searching for SCI client connection ID
for /f “delims== tokens=1-3″ %%m in (’find /n “SC Interface ‘%APP%’ connected” %TEMP%\cts-status-log.log’) do (
set CLIENT=%%o
for /f “delims=[]” %%t in (’echo %%m’) do set /a STARTLINE=%%t-1 2>nul
rem echo %%m=%%n=%%o >> %result%
)
if .%CLIENT%.==.. (
echo Could not find client connection. Did you lauch SCI first? > %result%
exit
)
echo Searching for application statuses
if exist %temp%\cts-status-log2.log del %temp%\cts-status-log2.log
for /F “tokens=* skip=%STARTLINE%” %%t in (%temP%\cts-status-log.log) do echo %%t >> %temp%\cts-status-log2.log
find “SCI(%CLIENT%,ctssci)” %TEMP%\cts-status-log2.log > %TEMP%\cts-status-log1.logecho Comparing application statuses against known good list: %NORMAL%
for /f “tokens=1-6 delims=(){}[]” %%i in (%TEMP%\cts-status-log1.log) do (
rem echo %%i %%j %%k %%l %%n
rem %%i — SCI
rem %%j — nnn,sci where nnn is client id
rem %%k — < ==
rem %%l — bbb, where bbb is dbid for app (I think)
rem %%m — app_name
rem %%n — app_status, mode
if “%%k” == ” <== ” (
rem echo “%%l} [%%m”
rem echo “%%k”
find “%%l} [%%n” %NORMAL% > nul
if errorlevel 1 (
echo %%l %%n IS WRONG
echo %%l %%n IS WRONG >> %result%
set BAD=true
)
)
)if not exist %result% echo No application status problems detected > %result%
start notepad %result%

