Automic Workload Automation

Expand all | Collapse all

How to determine Agents defined to the system / currently online and there version?

  • 1.  How to determine Agents defined to the system / currently online and there version?

    Posted Jul 07, 2017 08:24 AM

    The following example shows the powerful potential of Automic Script Functions to fulfil this request:

     

    :read &AGENT_ONLINE_SWITH#,"'Y','N'",'Cover Agents currently online only?','N' :p '---------------------------------------------------------' :s &SYSNAME# = GET_UC_SYSTEM_NAME() :s &AE_VERSION# = SYS_INFO(SERVER, VERSION, ALL) :p 'Automation Engine Name;Version' :p '&SYSNAME#;&AE_VERSION#' :p '---------------------------------------------------------' :if &AGENT_ONLINE_SWITH# = 'Y' :  p 'List of Agents currently online:' :else :  p 'List of Agents definded:' :endif :p 'Agent Name;Agent Version' :p '---------------------------------------------------------' :s &HND# = prep_process_var(UC_EX_HOSTCHAR) :process &HND# :  s &AGENTNAME# = GET_PROCESS_LINE(&HND#, 1) :  s &AGENT_VERSION# = get_var(UC_EX_VERSION, &AGENTNAME#) :  if &AGENT_ONLINE_SWITH# = 'Y' :    s &AGENT_ONLINE# = SYS_HOST_ALIVE(&AGENTNAME#) :    if &AGENT_ONLINE# = 'Y' :      p '&AGENTNAME#;&AGENT_VERSION#' :    endif :  else :    p '&AGENTNAME#;&AGENT_VERSION#' :  endif :endprocess :close_process &HND# :p '---------------------------------------------------------'

     

    • In the beginning the user can chose if the result should contain only Agents, which are currently online or all Agents defined to the system.
    • Then as an additional feature the Automation Engine name and version is queried and printed.
    • Next the script processes UC_EX_HOSTCHAR to find all Agents defined to the system.
    • Finally the Agent Variable UC_EX_VERSION is used to determine the Agent version.
    • Depending on the choice made above, SYS_HOST_ALIVE is used to check if the Agent is online with the Automation Engine.

     Here an example for possible results:  

    2017-07-07 14:06:30 - U0020206 Variable 'AGENT_ONLINE_SWITH#' was stored with value 'Y'. 2017-07-07 14:06:30 - U0020408 --------------------------------------------------------- 2017-07-07 14:06:30 - U0020408 Automation Engine Name;Version 2017-07-07 14:06:30 - U0020408 WO10;10.0.8+hf.4.build.16920 2017-07-07 14:06:30 - U0020408 --------------------------------------------------------- 2017-07-07 14:06:30 - U0020408 List of Agents currently online: 2017-07-07 14:06:30 - U0020408 Agent Name;Agent Version 2017-07-07 14:06:30 - U0020408 --------------------------------------------------------- 2017-07-07 14:06:30 - U0020408 DB_SERVICE_WO10;10.0.6+build.495 2017-07-07 14:06:30 - U0020408 SWGAS403;10.0.6-dev+low.build.412 2017-07-07 14:06:30 - U0020408 VWGSUP11;10.0.6+build.495 2017-07-07 14:06:30 - U0020408 VWGSUP11_#2;10.0.6+build.495 2017-07-07 14:06:30 - U0020408 VWGSUP11_RA_FTP;10.0.8+build.633 2017-07-07 14:06:30 - U0020408 VWGSUP11_RA_WEBSERVICE;10.0.8+build.633 2017-07-07 14:06:30 - U0020408 VWGSUP11_SAP_ECC;10.0.7+build.392 2017-07-07 14:06:30 - U0020408 VWGSUP11_SAP_JAVA;10.0.5+build.397 2017-07-07 14:06:30 - U0020408 VWGSUP11_SQL_ORACLE;10.0.7+build.392 2017-07-07 14:06:30 - U0020408 ---------------------------------------------------------



  • 2.  How to determine Agents defined to the system / currently online and there version?

    Posted Nov 30, 2017 02:46 AM
    A customer asked, how he can find the listener ports of his agents. The above script can be extended to show more information about agents by using other Agent Variables (see here for a list). To see the ports, you e.g. use UC_EX_IP_PORT.

    :read &AGENT_ONLINE_SWITH#,"'Y','N'",'Cover Agents currently online only?','N'
    :p '---------------------------------------------------------'
    :s &SYSNAME# = GET_UC_SYSTEM_NAME()
    :s &AE_VERSION# = SYS_INFO(SERVER, VERSION, ALL)
    :p 'Automation Engine Name;Version'
    :p '&SYSNAME#;&AE_VERSION#'
    :p '---------------------------------------------------------'
    :if &AGENT_ONLINE_SWITH# = 'Y'
    :  p 'List of Agents currently online:'
    :else
    :  p 'List of Agents definded:'
    :endif
    :p 'Agent Name;Agent Version;Is active;Type;Agent Port'
    :p '---------------------------------------------------------'
    :s &HND# = prep_process_var(UC_EX_HOSTCHAR)
    :process &HND#
    :  s &AGENTNAME# = GET_PROCESS_LINE(&HND#, 1)

    :  s &AGENT_VERSION# = get_var(UC_EX_VERSION, &AGENTNAME#)
    :  s &AGENT_PORT# = get_var(UC_EX_IP_PORT, &AGENTNAME#)
    :  s &AGENT_SW# = get_var(UC_HOST_SW, &AGENTNAME#)

    :  if &AGENT_ONLINE_SWITH# = 'Y'
    :    s &AGENT_ONLINE# = SYS_HOST_ALIVE(&AGENTNAME#)
    :    if &AGENT_ONLINE# = 'Y'
    :      s &temp# = SYS_HOST_ALIVE(&AGENTNAME#)
    :      p '&AGENTNAME#;&AGENT_VERSION#;&temp#;&AGENT_SW#;&AGENT_PORT#'
    :    endif
    :  else
    :    s &temp# = SYS_HOST_ALIVE(&AGENTNAME#)
    :    p '&AGENTNAME#;&AGENT_VERSION#;&temp#;&AGENT_SW#;&AGENT_PORT#'
    :  endif
    :endprocess
    :close_process &HND#
    :p '---------------------------------------------------------'