Sunday, 1 February 2015

TIBCO - Get some EMS statistics (Windows)

1. Write the bat file EMS_Statistic_cmd.bat with following content:

@ECHO OFF
REM Basic Configuration =========================================
REM Set directory
set EMS_HOME=c:\tibco\ems\5.1\bin
set TARGET_EMS=tcp://10.20.2.251:7222
set EMS_USER=admin
set EMS_PASS=T1bc0_prd_jms
set OUT_FILE_NAME=Statistic_out_
set FILE_POSTFIX=TIBCO_NEWPROD_EMS_7222
rem set maxbytesize=10000000
REM Basic Configuration =========================================


:loop
for /f "tokens=1-3 delims=:." %%a in ("%time%") do set timestamp=%%a:%%b:%%c
for /f "tokens=1-3 delims=/." %%a in ("%date%") do set datestamp=%%a/%%b/%%c
rem echo current date time is: %datestamp%-%timestamp%
rem echo the file name will be: %OUT_FILE_NAME%%FILE_POSTFIX%.txt
echo.

REM pslist -x  %1% 2>&1
echo.

%EMS_HOME%\tibemsadmin -server %TARGET_EMS% -script EMS_Statistic_cmd.script -ignore -user %EMS_USER% -password %EMS_PASS% >%OUT_FILE_NAME%%FILE_POSTFIX%.txt
echo.


sleep 20

echo =================================================

rem FOR /F "usebackq" %%A IN ('"%OUT_FILE_NAME%%FILE_POSTFIX%.txt"') DO set size=%%~zA
rem  if %size% LSS %maxbytesize% (
rem    echo.%OUT_FILE_NAME%%FILE_POSTFIX%.txt is ^< %maxbytesize% bytes
rem ) ELSE (
rem     echo.%OUT_FILE_NAME%%FILE_POSTFIX%.txt is ^>= %maxbytesize% bytes
rem     set FILE_POSTFIX=%datestamp%-%timestamp%   
rem )

IF one == one (goto loop)
:endloop



2. Write the EMS_Statistic_cmd.script with content:
time on
timeout 120
info
show connections full
show topics
show queues
show consumers full
show db

3. Run the script and collecting the stats
























4 comments:

  1. Hi Warren, Im not able to execute this script im getting error unable to find sleep command and also I tried timeout command,Still same problem,Please help me with right cscript ,
    My Name is Solomon
    Email Id: solmonbtech@gmail.com
    Contact no:91 9790580693

    ReplyDelete
  2. Can we get same script for Unix with HTML table

    ReplyDelete
  3. Replacing SLEEP 20 with TIMEOUT 20 works for me on Windows 7

    Thanks for the script by the way!

    ReplyDelete
  4. Hi Robert & Warren can we get same script in UNIX with HTML output

    ReplyDelete