Page 1 of 1

Found which Tm1 servers are working

Posted: Sun Apr 01, 2012 12:14 pm
by EP_explorer
Is possible using TI commands (or by another way) found which TM1 servers are working in current moment at host?

Re: Found which Tm1 servers are working

Posted: Sun Apr 01, 2012 7:16 pm
by David Usherwood
Suggest you look at using Powershell, on the lines of
get-service -name tm1

Re: Found which Tm1 servers are working

Posted: Sun Apr 01, 2012 9:10 pm
by lotsaram
David Usherwood wrote:Suggest you look at using Powershell, on the lines of
get-service -name tm1
I wouldn't trust just knowing that the service was running, what if the server is "up" but non-responsive? If there really truly was a need for it (and that's a decent sized if) then I'd be inclined to either
- have an app that routinely logs in, retrieves a known view and logs out and informs if there is a hang on log in or wait on view retrieval
- have an app that monitors a top log output and informs if there are ever > x threads in wait status for > x seconds
- ask a certain Mr B Hill if he would add such a monitoring tool to his CubeSpy application

Re: Found which Tm1 servers are working

Posted: Mon Apr 02, 2012 12:36 am
by rmackenzie
EP_explorer wrote:Is possible using TI commands (or by another way) found which TM1 servers are working in current moment at host?
Just create a new process and put this in the Prolog:

Code: Select all

# turn off quoting
DatasourceASCIIQuoteCharacter = '';

# set up file names
sDataDirectoryPath = 'C:\YOUR\TM1\DATA\DIRECTORY\';
sOutputFileName = 'current_instances.txt';
sFullOutputFileName = '"' | sDataDirectoryPath  | sOutputFileName | '"';

# this does the work
sCommand = 'tasklist /svc /fi "imagename eq tm1sd.exe" /fo csv > ' | sFullOutputFileName ;

# run the batch
sBatchFileName = sDataDirectoryPath | 'get_current_instances.bat';
AsciiOutput ( sBatchFileName, sCommand );
ExecuteCommand ( sBatchFileName, 1 );

# now pass this file back to TM1
#ExecuteProcess ( 'YOUR_PROCESS', 'pTM1InstanceFileName', sFullOutputFileName );
That works for me, how about you? The CSV will be easily readable by another TM1 process that you can write to work through the file and do something with the information.

Re: Found which Tm1 servers are working

Posted: Mon Apr 02, 2012 4:40 am
by rmackenzie
lotsaram wrote:I wouldn't trust just knowing that the service was running, what if the server is "up" but non-responsive?
The output from the command (used in the code I posted) includes the PID (process identifier):

Code: Select all

tasklist /svc /fi "imagename eq tm1sd.exe" /fo csv
You can also run this command using /v for verbose output (drop the /svc):

Code: Select all

tasklist /v /fi "imagename eq tm1sd.exe" /fo csv
Which will give the current memory usage, cpu time and 'status' by PID. You can then 'join' on PID and find out the current memory usage and CPU time per TM1 instance directly from TI. On my machine, 'status' is always unknown, but monitoring deltas in CPU time should show 'responsiveness'.

Actually, you can start to get a bit clever and say:

Code: Select all

tasklist /svc /fi "imagename eq tm1sd.exe" /fi "memusage gt 20000000" /fo csv
Which says 'give me every TM1 instance where memory usage is currently above 20Gb'.

More information available here.

YMMV

Re: Found which Tm1 servers are working

Posted: Tue Apr 03, 2012 5:54 pm
by EP_explorer
Thank you for answers