Josef_Scharl_103

How to determine the available SAP Agents within a client and their current status?

Discussion created by Josef_Scharl_103 on Mar 3, 2017
The following example shows the powerful potential of Automic Script Functions to fulfil this request:
:s &HND# = prep_process_var(UC_EX_HOSTCHAR)
:p 'List of SAP Agents:'
:p '---------------------------------------------------------'
:process &HND#
:  s &AGENTNAME# = GET_PROCESS_LINE(&HND#, 1)
:  s &HOSTOS = get_var(UC_HOST_JCL_VAR, &AGENTNAME#)
:  if &HOSTOS = 'SAP'
:    p 'Agent Name:                      &AGENTNAME#'
:    s &AGENT_IP_ADDR# = get_var(UC_EX_IP_ADDR, &AGENTNAME#)
:    p 'Agent IP Address:                &AGENT_IP_ADDR#'
:    s &AGENT_VERSION# = get_var(UC_EX_VERSION, &AGENTNAME#)
:    p 'Agent Version:                   &AGENT_VERSION#'
:    s &AGENT_SAP_BASIS_VERSION# = get_var(UC_HOST_SW_VERS, &AGENTNAME#)
:    p 'Agent SAP Version:               &AGENT_SAP_BASIS_VERSION#'
:    s &AGENT_CONN_ABAP# = get_var(UC_HOST_CONN_ABAP, &AGENTNAME#)
:    p 'Agent SAP Connection Name:       &AGENT_CONN_ABAP#'
:    s &AGENT_ONLINE# = SYS_HOST_ALIVE(&AGENTNAME#)
:    p 'Agent Online within AE System:   &AGENT_ONLINE#'
:    s &AGENT_SAP_ONLINE# = SYS_HOST_ALIVE(&AGENTNAME#, &AGENT_CONN_ABAP#)
:    p 'Agent SAP Connection Online:     &AGENT_SAP_ONLINE#'
:    p '---------------------------------------------------------'
:  endif
:endprocess
:close_process &HND#

In the beginning it processes UC_EX_HOSTCHAR to find all Agents defined to the system.
Then several Agent Variables (UC_*) are used to determine different Agent characteristics, like Agent type, IP Address and so on.
Using SYS_HOST_ALIVE checks if the Agent is online with the Automation Engine System and if the connection to the SAP System works as well.

 

Here an example for possible results:

 

2017-03-03 14:08:03 - U00020408 List of SAP Agents:
2017-03-03 14:08:03 - U00020408 ---------------------------------------------------------
2017-03-03 14:08:03 - U00020408 Agent Name:                      VWGSUP01_SAP
2017-03-03 14:08:03 - U00020408 Agent IP Address:                192.168.115.160
2017-03-03 14:08:03 - U00020408 Agent Version:                   8.00A918-101
2017-03-03 14:08:03 - U00020408 Agent SAP Version:               7.40
2017-03-03 14:08:03 - U00020408 Agent SAP Connection Name:       CONN.R3.E47
2017-03-03 14:08:03 - U00020408 Agent Online within AE System:   Y
2017-03-03 14:08:03 - U00020408 Agent SAP Connection Online:     Y
2017-03-03 14:08:03 - U00020408 ---------------------------------------------------------
2017-03-03 14:08:04 - U00020408 Agent Name:                      VWGSUP11_SAP_JAVA
2017-03-03 14:08:04 - U00020408 Agent IP Address:                192.168.115.101
2017-03-03 14:08:04 - U00020408 Agent Version:                   10.0.5+build.397
2017-03-03 14:08:04 - U00020408 Agent SAP Version:               7.00
2017-03-03 14:08:04 - U00020408 Agent SAP Connection Name:       CONN.R3.ECC
2017-03-03 14:08:04 - U00020408 Agent Online within AE System:   N
2017-03-03 14:08:04 - U00020408 Agent SAP Connection Online:     ?
2017-03-03 14:08:04 - U00020408 ---------------------------------------------------------
2017-03-03 14:08:04 - U00020408 Agent Name:                      VWGSUP12_SAP_ECC
2017-03-03 14:08:04 - U00020408 Agent IP Address:                192.168.0.49
2017-03-03 14:08:04 - U00020408 Agent Version:                   11.2.3+build.416
2017-03-03 14:08:04 - U00020408 Agent SAP Version:               7.00
2017-03-03 14:08:04 - U00020408 Agent SAP Connection Name:       CONN.R3.ECC
2017-03-03 14:08:04 - U00020408 Agent Online within AE System:   Y
2017-03-03 14:08:04 - U00020408 Agent SAP Connection Online:     Y
2017-03-03 14:08:04 - U00020408 ---------------------------------------------------------

 


Outcomes