IBM Support

How to automatically start TM1Top with a TM1 Server

Question & Answer


Question

This Technote explains how to automatically start TM1Top.exe when a TM1 server starts. Please note that the tm1top.exe program was not provided with TM1 10.2 to TM1 10.2.2 Fixpack 3. The tm1top.exe program can be found in the bin64 directory of the TM1 Server install from TM1 10.2.2 Fixpack 4 onwards. This technique is useful when the TM1 model has a scheduled automatic restart and tm1top logging is required. This is a Windows specific solution.

Answer

Overview:

To start TM1Top on startup create a TM1 Server startup chore that calls a Ti process that runs a batch script using the ExecuteCommand function. The batch script will check for and terminate any existing TM1Top process then starts a new TM1Top process.

Steps:

1 - Create a new Ti process that uses ExecuteCommand to call the batch script

Create a Ti process with the data source type set to none, and the following code in the Prolog section. The name of the Ti process in this example is StartTop. All variables the may need to be adjusted to match the environment are shown in green.


vEXE = 'tm1top.exe';
vKILLTOP = 'cmd /c "taskkill /IM ' | vEXE | ' /F"';
ExecuteCommand ( vKILLTOP, 1 );

vNOW = NumberToString(now);
vADMINHOST = 'tm1server.local.com';
vSERVERNAME = 'Planning Sample';
vLOGPERIOD = 5;
vLOGAPPEND = 'F';
vAUTOTOPBATCH = 'D:\Program Files\ibm\cognos\tm1_64\bin64\StartTop.bat';
vTOPPATH = 'D:\Program Files\ibm\cognos\tm1_64\bin64';
vLOGPATH = 'D:\TM1Logs\tm1top.log';
vBACKUPLOG = 'tm1top_' | vNOW | '.log';

IF(FileExists(vLOGPATH) =1);
vRENAMECMD = 'cmd /c "rename ' | vLOGPATH | ' ' | vBACKUPLOG | '"';
ExecuteCommand ( vRENAMECMD, 1 );
ELSE;
ENDIF;

vTOPCMD = 'cmd /c ""' | vAUTOTOPBATCH |'" "' | vTOPPATH | '" "' | vADMINHOST | '" "' | vSERVERNAME | '" "' | NumberToString(vLOGPERIOD) | '" "' | vLOGAPPEND | '" "' | vLOGPATH | '"';

ExecuteCommand(vTOPCMD, 0);

In this example the name of the TM1Top program file is tm1top.exe. It's also possible to make copies of the tm1top.exe process with unique names for each TM1 model. For example; tm1top_sdata.exe and tm1top_planSamp.exe. Unique TM1Top process names allow for each TM1 model to stop and start it's own instance of the TM1Top process.

This batch script also sets the name of the log file created by TM1Top. The log file can be renamed in the script to be unique for each TM1 model or to include the timestamp the log file was created. Note that TM1Top does not lock the log file. If multiple TM1 models are running on the same system then each instance of TM1Top should write to a log file with a unique name.



2 - Create a Chore to run the Ti process

In this example we will name the chore StartTop which calls only the starttop Ti process.

3 - Create the batch file named StartTop.bat

In this example we create the batch file in the TM1 Servers bin64 directory. This batch is called by the ExecuteCommand Ti function in the TM1 Server startup chore.




set vTOPPATH=%1
set vADMINHOST=%2
set vSERVERNAME=%3
set vLOGPERIOD=%4
set vLOGAPPEND=%5
set vLOGPATH=%6

start /wait ping -n 15 127.0.0.1

cd %vTOPPATH%

tm1top.exe -adminhost %vADMINHOST% -servername %vSERVERNAME% -logperiod %vLOGPERIOD% -logappend %vLOGAPPEND% -logfile %vLOGPATH%

Note that this batch file has a delay using the ping command. The delay may need to be adjusted to allow the TM1 Server to finish it's startup process. If the delay is not long enough then TM1Top will not be able to connect and no logging will be generated.

4 - Set the following parameter in the tm1s.cfg file



StartupChores=StartTop

[{"Product":{"code":"SS9RXT","label":"Cognos TM1"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"TM1 Server","Platform":[{"code":"PF033","label":"Windows"}],"Version":"9.5.2;10.1.0;10.1.1;10.2;10.2.2","Edition":"All Editions","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 June 2018

UID

swg21958055