Found which Tm1 servers are working

Post Reply
EP_explorer
Regular Participant
Posts: 221
Joined: Sat Dec 04, 2010 2:35 pm
OLAP Product: PAL
Version: 2.0.9
Excel Version: 2016

Found which Tm1 servers are working

Post by EP_explorer »

Is possible using TI commands (or by another way) found which TM1 servers are working in current moment at host?
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Found which Tm1 servers are working

Post by David Usherwood »

Suggest you look at using Powershell, on the lines of
get-service -name tm1
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Found which Tm1 servers are working

Post 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
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Found which Tm1 servers are working

Post 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.
Robin Mackenzie
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Found which Tm1 servers are working

Post 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
Robin Mackenzie
EP_explorer
Regular Participant
Posts: 221
Joined: Sat Dec 04, 2010 2:35 pm
OLAP Product: PAL
Version: 2.0.9
Excel Version: 2016

Re: Found which Tm1 servers are working

Post by EP_explorer »

Thank you for answers
Post Reply