8 Replies Latest reply: Dec 9, 2010 9:50 AM by ohad redlich RSS

Getting Host (and Domain) Name from KM - not that simple...

ohad redlich

Hi,

 

I'm trying to create a dynamic chart (using the built-in chart() function). In order to do this, I need to get the host name of the agent. I understand that this name must be the same as the one I see in the Patrol Console. However, when i call get("hostname"), i get the host without the domain name, while in the console i see my host with the domain attached to it. becuase of this, the chart does not show my data. If i change the code, and instead of the call  get("hostname") i put hard-coded'ly the host and the domain, it works and i see the data.

 

Does anyone know how to solve this issue? how can i get the host name of the agent exactly like i see it in the Patrol Console?

 

In the example below, the host name that I see in the console is "iBMC-99FZG4J.adprod.bmc.com", but when I call get("hostname"), i get only

iBMC-99FZG4J.

 

thanks,

Ohad

 

patrol.JPG

  • 1. Getting Host Name from KM - not that simple...
    Timo Schmidt

    Hi Ohad,

     

    the problem is that your screenshot is showing a PATROL Clasic Console. Witihin this console you define the connection settings for your PATROL Agent and you are allowed to use everything the agent is reachable with. But the agent is not aware of that,

    e.g. Windows host file definitions. I just took a quick look to the agent variables but did not find one to make him telling the fully qualified name ...

     

    Regards,

     

    Timo

  • 2. Getting Host Name from KM - not that simple...
    ohad redlich

    Thanks for the reply, Timo,

     

    I'm not sure i got the point: I want to work with Classic Console (and not Central).

    If i cannot get the domain name of the agent from the agent variables, how can I get it? I guess that there must be a way, since the UI shows the host name with the domain. If I only knew where PATROL keeps it, I could take it from there...you have any idea?

     

    thanks,

    Ohad

  • 3. Getting Host Name from KM - not that simple...
    Geert De Peuter

    If you call this from a menu command (which I assume you will), you can use console macro's to find the exact name.

    In this case you are interested in the %{HOSTNAME} macro which the console will replace in the menu command when executing it on the agent.

     

    -- Geert

     

    APP_TYPE : Application name (e.g., ORACLE)

    COMP_STATUS : Computer’s state (e.g., VOID, OK, WARNING)

    COMP_TYPE : Computer type (e.g., SOLARIS)

    CON_INFO : Network connection information (e.g., host name or net address)

    CON_STATUS : Network connection state (e.g., OK, Soft Problem)

    CON_TYPE : network connection type (UDP or TCP)

    DISPLAY_NAME : Host name where the console is displayed

    HOME : Home of this parameter, task, or command

    HOSTNAME : Host name

    INSTANCE_ID : Instance id (e.g., ORACLE SID)

    LANGUAGE : The language to use in sound

    PASSWORD : User’s password

    SID : Instance id (e.g., ORACLE SID)

    STATUS : Status of computer or task

    TIME : Current time of day

    USERNAME : User’s login name

    VOLUME : Sound volume

    WORST_CHILD : Worst child (parameter or instance) running on this object

  • 4. Getting Host Name from KM - not that simple...
    ohad redlich

    Geert,

     

    I'm running the code from a KM, not from a menu. As i wrote above, I call get("hostname") and i do get the host name, but the problem is that I get it without the domain name. Is there a way to get the domain name?

  • 5. Getting Host Name from KM - not that simple...
    Geert De Peuter

    How do you plan to run this code ?  I would assume not from a parameter - but from a menu command ?

    If you would do it from a parameter - then when and who will you show the chart to ?

     

    If this is done from the menu command you can get the computer name as it is defined in the console.

    However if your question is - how can I get the hostname without the domainname, an nthargf() will do the trick (just take the first argument separated by a ".").

     

    If you want to do what I think you want to do - you will need the name of the agent the same way as how it's added in the console - and only the console knows that information (hence the macro's is the only bulletproof solution).

  • 6. Getting Host Name from KM - not that simple...
    ohad redlich

    Geert,

    You are right... I run it from a menu command (sorry for the confusion; I'm not an expert in PATROL [yet... ]).

    Anyways, again: when i call get("hostname"), i get the name without the domain, and this is the reason why it does not work, because in the console, from some reason that i dont know,  the agent is recognized WITH the domain name. So how can i get the domain name?

  • 7. Getting Host Name from KM - not that simple...
    Geert De Peuter

    If you are running it from a menu command, please try the following

     

    Instead of doing

    myhostname = get("hostname");

    do

    myhostname = "%{HOSTNAME}";

     

    This should do the trick and return the hostname like it is known by the console.

  • 8. Getting Host Name from KM - not that simple...
    ohad redlich

    Working!!

    thanks a lot!

     

    Ohad