Topic
  • 12 replies
  • Latest Post - ‏2012-07-20T13:07:45Z by RobertTanenbaum
Vemireddy
Vemireddy
6 Posts

Pinned topic List of Servers in AdminHost

‏2012-06-20T19:35:15Z |
Dear Friends,
I am looking for your help on 2 things:
1) Can you please provide solution on how to list all the servers resides on an given adminhost? Or atleast list of servers that are active.
2) Is there any TM1 function to check if a given server is active(up and running) or not?

Quick reply would be highly appreciated
Updated on 2012-07-20T13:07:45Z at 2012-07-20T13:07:45Z by RobertTanenbaum
  • SystemAdmin
    SystemAdmin
    658 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-21T05:54:42Z  
    You can check all TM1 servers that are existing and running/not running on a server from services in windows(Control Panel). I am not sure if there is any function through which you can check list of all available servers in TM1.
  • Vemireddy
    Vemireddy
    6 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-21T14:38:41Z  
    You can check all TM1 servers that are existing and running/not running on a server from services in windows(Control Panel). I am not sure if there is any function through which you can check list of all available servers in TM1.
    Hi Pooja, Thanks a lot for responding. My query is that instead of manually checking the status of server everytime, I want to get the status of servers to a file automatically with some sort or TI process or a batch code. Can you help on this?
  • SystemAdmin
    SystemAdmin
    658 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-22T09:36:33Z  
    • Vemireddy
    • ‏2012-06-21T14:38:41Z
    Hi Pooja, Thanks a lot for responding. My query is that instead of manually checking the status of server everytime, I want to get the status of servers to a file automatically with some sort or TI process or a batch code. Can you help on this?
    Lets see if this can help you
    First Run the TM1 Admin Server as an Application on Windows( i presume that you are using windows).
    Use the following link to do that

    http://publib.boulder.ibm.com/infocenter/ctm1/v10r1m0/index.jsp?topic=%2Fcom.ibm.swg.ba.cognos.tm1_op.10.1.0.doc%2Ft_runningthewindowsadminserverasanapplication_n14013f.html

    Secondly "View Admin Server Status", which will give you the information about: Time at which the Admin Server was started, Machine on which it is running, Port being used and Details of each TM1 server currently registered with the Admin Server. For steps refer the following link.
    http://publib.boulder.ibm.com/infocenter/ctm1/v10r1m0/index.jsp?topic=%2Fcom.ibm.swg.ba.cognos.tm1_op.10.1.0.doc%2Ft_runningthewindowsadminserverasanapplication_n14013f.html

    I hope you are doing it in a testing environemnt. i tried doing the same bue since i had no admin privilegs i couldn'y accomplish. Give a try if you can.
  • Rizwan.Kaif
    Rizwan.Kaif
    197 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-24T14:00:52Z  
    • Vemireddy
    • ‏2012-06-21T14:38:41Z
    Hi Pooja, Thanks a lot for responding. My query is that instead of manually checking the status of server everytime, I want to get the status of servers to a file automatically with some sort or TI process or a batch code. Can you help on this?
    If you are in Windows environment then you can use the net stat command to give you a list of all the Services that are currently running.

    At the command prompt using the "Redirected Operator" you and send the results of any command to a Text file. Example
    
    cmd /c dir > c:\test.txt
    


    Hope that helps!
    Rizwan Kaif
  • Vemireddy
    Vemireddy
    6 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-25T18:59:28Z  
    Lets see if this can help you
    First Run the TM1 Admin Server as an Application on Windows( i presume that you are using windows).
    Use the following link to do that

    http://publib.boulder.ibm.com/infocenter/ctm1/v10r1m0/index.jsp?topic=%2Fcom.ibm.swg.ba.cognos.tm1_op.10.1.0.doc%2Ft_runningthewindowsadminserverasanapplication_n14013f.html

    Secondly "View Admin Server Status", which will give you the information about: Time at which the Admin Server was started, Machine on which it is running, Port being used and Details of each TM1 server currently registered with the Admin Server. For steps refer the following link.
    http://publib.boulder.ibm.com/infocenter/ctm1/v10r1m0/index.jsp?topic=%2Fcom.ibm.swg.ba.cognos.tm1_op.10.1.0.doc%2Ft_runningthewindowsadminserverasanapplication_n14013f.html

    I hope you are doing it in a testing environemnt. i tried doing the same bue since i had no admin privilegs i couldn'y accomplish. Give a try if you can.
    Hi Pooja.. Thanks for the solution. But it is not working for me. Can I have your email address?
  • Vemireddy
    Vemireddy
    6 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-26T13:57:05Z  
    If you are in Windows environment then you can use the net stat command to give you a list of all the Services that are currently running.

    At the command prompt using the "Redirected Operator" you and send the results of any command to a Text file. Example
    <pre class="jive-pre"> cmd /c dir > c:\test.txt </pre>

    Hope that helps!
    Rizwan Kaif
    Hi Rizwan thanks for your post... If possible can you plz share the code to provide actual parameters to the command promt line?
    Example:
    Suppose adminhost name is "abc" and it has 3 servers 'a1', 'b1', 'c1' residing on it.
    'a1' and 'b1' are running on server and server 'c1' is down. How to identify this without manual intervention.
    I need an application or any other work around to identify which server is down.
    please suggest.

    Regarda
    Pavan
  • Rizwan.Kaif
    Rizwan.Kaif
    197 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-26T14:26:09Z  
    • Vemireddy
    • ‏2012-06-26T13:57:05Z
    Hi Rizwan thanks for your post... If possible can you plz share the code to provide actual parameters to the command promt line?
    Example:
    Suppose adminhost name is "abc" and it has 3 servers 'a1', 'b1', 'c1' residing on it.
    'a1' and 'b1' are running on server and server 'c1' is down. How to identify this without manual intervention.
    I need an application or any other work around to identify which server is down.
    please suggest.

    Regarda
    Pavan
    Pavan,

    At the command prompt you can enter the following command:

    
    net start > c:\services.txt
    


    Steps to check if Server is running:

    1) Write a TI which uses the ExecuteCommand() function to create the above Text file.
    2) Once you have the Text file, use it as a Data Source and parse through line by line.
    3) When you parse through each line, use the SCAN() function to look for the name of the servers. If there is a match then it means the server is running and vice versa.

    
    vLine = #This variable is the data source line 
    
    for your TI   IF ( SCAN(
    'a1', vLine) > 0 ); #Server a1 is running ENDIF;   IF ( SCAN(
    'b1', vLine) > 0 ); #Server b1 is running ENDIF;   IF ( SCAN(
    'c1', vLine) > 0 ); #Server c1 is running ENDIF;
    


    Give it a try. It should work.

    Cheers!
    Rizwan Kaif
  • Vemireddy
    Vemireddy
    6 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-26T20:31:06Z  
    Pavan,

    At the command prompt you can enter the following command:

    <pre class="jive-pre"> net start > c:\services.txt </pre>

    Steps to check if Server is running:

    1) Write a TI which uses the ExecuteCommand() function to create the above Text file.
    2) Once you have the Text file, use it as a Data Source and parse through line by line.
    3) When you parse through each line, use the SCAN() function to look for the name of the servers. If there is a match then it means the server is running and vice versa.

    <pre class="jive-pre"> vLine = #This variable is the data source line for your TI IF ( SCAN( 'a1', vLine) > 0 ); #Server a1 is running ENDIF; IF ( SCAN( 'b1', vLine) > 0 ); #Server b1 is running ENDIF; IF ( SCAN( 'c1', vLine) > 0 ); #Server c1 is running ENDIF; </pre>

    Give it a try. It should work.

    Cheers!
    Rizwan Kaif
    Hi Rizwan.. Seems like your idea is working. But i didn't see any TM1 server in the text file.
    I may not have required privileges. Is it possible to run the command you shared from TI process? So that it may run on the admin server.

    Regards,
    Pavan Vemireddy
  • Rizwan.Kaif
    Rizwan.Kaif
    197 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-26T20:57:53Z  
    • Vemireddy
    • ‏2012-06-26T20:31:06Z
    Hi Rizwan.. Seems like your idea is working. But i didn't see any TM1 server in the text file.
    I may not have required privileges. Is it possible to run the command you shared from TI process? So that it may run on the admin server.

    Regards,
    Pavan Vemireddy
    The ExecuteCommand() function in TM1 which allows you to run the external command. You can use it to run the command which I gave you in the previous post.
    Cheers!
    Rizwan Kaif
  • Vemireddy
    Vemireddy
    6 Posts

    Re: List of Servers in AdminHost

    ‏2012-06-26T21:33:21Z  
    The ExecuteCommand() function in TM1 which allows you to run the external command. You can use it to run the command which I gave you in the previous post.
    Cheers!
    Rizwan Kaif
    Thank you Very much Rizwan. i will try this option and let you know. Thanks for your help. can i have your email address?
  • RobertTanenbaum
    RobertTanenbaum
    14 Posts

    Re: List of Servers in AdminHost

    ‏2012-07-20T13:01:24Z  
    Here's a very simple console application written in C# that will list out the servers.
    You have to reference C:\Program Files\Cognos\TM1\bin\Applix.TM1.API.dll when you build it.
    This is using the Applix TM1 .Net API, but I am sure you could also use the JAVA or C/C++ API to do the same thing.
    using System;
    using Applix.TM1.API;

    namespace Tm1ConsoleApp2
    {
    class Program
    {
    static int Main(string[] args)
    {
    int nRtrn = 1;
    TM1AdminServer adminServer = null;
    try
    {
    Console.WriteLine("Entering main");
    adminServer = new TM1AdminServer("hostname", "tm1adminserver");
    if (adminServer == null)
    {
    Console.WriteLine("Failed to instantiate new TM1AdminServer");
    nRtrn = -1;
    }
    else
    {
    Console.WriteLine("Success to instantiate new TM1AdminServer");
    Console.WriteLine("adminServer.Servers.Count=" + adminServer.Servers.Count);
    int serverCounter = 0;
    foreach (TM1ServerInfo sInfo in adminServer.Servers)
    {
    serverCounter++;
    Console.WriteLine(serverCounter + " serverInfo.HostAddress=" + sInfo.HostAddress);
    Console.WriteLine(serverCounter + " serverInfo.HostName=" + sInfo.HostName);
    Console.WriteLine(serverCounter + " serverInfo.Name=" + sInfo.Name);
    }
    }
    }
    catch (Exception e)
    {
    Console.WriteLine("Caught exception: " + e.Message);
    if (e.InnerException != null)
    {
    Console.WriteLine("Inner exception: " + e.InnerException.Message);
    }
    nRtrn = -4;
    }
    Console.Write("Enter any key to exit");
    Console.ReadKey();
    return nRtrn;
    }
    }
    }
  • RobertTanenbaum
    RobertTanenbaum
    14 Posts

    Re: List of Servers in AdminHost

    ‏2012-07-20T13:07:45Z  
    Here's a very simple console application written in C# that will list out the servers.
    You have to reference C:\Program Files\Cognos\TM1\bin\Applix.TM1.API.dll when you build it.
    This is using the Applix TM1 .Net API, but I am sure you could also use the JAVA or C/C++ API to do the same thing.
    using System;
    using Applix.TM1.API;

    namespace Tm1ConsoleApp2
    {
    class Program
    {
    static int Main(string[] args)
    {
    int nRtrn = 1;
    TM1AdminServer adminServer = null;
    try
    {
    Console.WriteLine("Entering main");
    adminServer = new TM1AdminServer("hostname", "tm1adminserver");
    if (adminServer == null)
    {
    Console.WriteLine("Failed to instantiate new TM1AdminServer");
    nRtrn = -1;
    }
    else
    {
    Console.WriteLine("Success to instantiate new TM1AdminServer");
    Console.WriteLine("adminServer.Servers.Count=" + adminServer.Servers.Count);
    int serverCounter = 0;
    foreach (TM1ServerInfo sInfo in adminServer.Servers)
    {
    serverCounter++;
    Console.WriteLine(serverCounter + " serverInfo.HostAddress=" + sInfo.HostAddress);
    Console.WriteLine(serverCounter + " serverInfo.HostName=" + sInfo.HostName);
    Console.WriteLine(serverCounter + " serverInfo.Name=" + sInfo.Name);
    }
    }
    }
    catch (Exception e)
    {
    Console.WriteLine("Caught exception: " + e.Message);
    if (e.InnerException != null)
    {
    Console.WriteLine("Inner exception: " + e.InnerException.Message);
    }
    nRtrn = -4;
    }
    Console.Write("Enter any key to exit");
    Console.ReadKey();
    return nRtrn;
    }
    }
    }
    OUCH! That looks so ugly when the message board removes all the tabs.
    So here's a more bare-bones program that hopefully won't be so confusing

    using System;
    using Applix.TM1.API;

    namespace Tm1ConsoleApp2
    {
    class Program
    {
    static void Main(string[] args)
    {
    TM1AdminServer adminServer = new TM1AdminServer("hostname", "tm1adminserver");
    if (adminServer != null)
    {
    Console.WriteLine("adminServer.Servers.Count=" + adminServer.Servers.Count);
    int serverCounter = 0;
    foreach (TM1ServerInfo sInfo in adminServer.Servers)
    {
    serverCounter++;
    Console.WriteLine(serverCounter + " serverInfo.HostAddress=" + sInfo.HostAddress);
    Console.WriteLine(serverCounter + " serverInfo.HostName=" + sInfo.HostName);
    Console.WriteLine(serverCounter + " serverInfo.Name=" + sInfo.Name);
    }
    }
    Console.Write("Enter any key to exit");
    Console.ReadKey();
    return;
    }
    }
    }