Josef_Scharl_103

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

Discussion created by Josef_Scharl_103 on Jul 7, 2017
Latest reply on Nov 30, 2017 by Claus_Jambrich_5663

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 ---------------------------------------------------------

Outcomes