PREP_PROCESS_AGENTGROUP does not return an agent name
search cancel

PREP_PROCESS_AGENTGROUP does not return an agent name

book

Article ID: 413267

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine CA Automic One Automation Automic SaaS

Issue/Introduction

A script that uses the PREP_PROCESS_AGENTGROUP function to retrieve an agent from an Agent Group (HOSTG) object may fail to return a value. When the script runs, the variable that should hold the agent name is empty, and the processing block for the data sequence is skipped. This can happen even if the same script works correctly in a different environment.

A typical script experiencing this issue would look like this:

:SET &HND# = PREP_PROCESS_AGENTGROUP(&HOSTG#)
:PROCESS &HND#
:  SET &AGENT# = GET_PROCESS_LINE(&HND#,1)
:  PRINT "Agent: &AGENT#"
:ENDPROCESS
:CLOSE_PROCESS &HND#

In the failing scenario, the PROCESS...ENDPROCESS block is not entered because the data sequence &HND# is empty.

Environment

Versions: 21.0 and higher

Cause

The PREP_PROCESS_AGENTGROUP function will only return agents that are both correctly defined and currently active. There are two primary causes for this issue:

  1. Agent is Not Active: The agent assigned to the Agent Group is not running or has lost connection to the Automation Engine. The function will not include inactive agents in its results.
  2. Incorrect Agent Name: The name of the agent as defined within the Agent Group (HOSTG) object does not exactly match the actual name of the agent object. This can be due to a typo or subtle character difference, such as a dash (-) instead of a period (.).

Resolution

To resolve this issue, you must ensure the agent is active and correctly defined in the Agent Group.

  1. Verify Agent Status:

    • Navigate to the Administration perspective in the Automic Web Interface (AWI).
    • Go to Agents & Groups -> Agents.
    • Filter for the agent you expect to be in the group and confirm its status is "Active". If it is not active, start the agent.
  2. Verify Agent Group Configuration:

    • In the Process Assembly perspective, locate and open the Agent Group (HOSTG) object being used by the script.
    • On the Agent Group page, review the names listed in the Assigned Agents section.
    • Carefully compare the agent names in the list with the actual agent names from the Administration perspective. Pay close attention to separators like periods (.), dashes (-), and underscores (_).
    • Click the Preview button at the bottom of the page.
      • If the preview returns "No item selected" or is empty, it confirms that no active agents match the criteria defined in the group.
    • Correct any incorrect agent names in the Assigned Agents list.
    • Save the Agent Group object.

After correcting the agent name and ensuring the agent is active, the script will successfully retrieve the agent.

Additional Information

For environments on version 21.0 and higher, agents may fail to start properly if the Java Communication Process (JCP) is not fully initialized. To prevent this, especially after a server restart, you can configure a startup delay for the agents in the Service Manager Dialog:

  1. Open the Service Manager Dialog.
  2. Move the JCP and REST processes to a position before any agents in the startup sequence.
  3. Right-click the first agent that should start, go to Properties, and increase the startup delay from the default (e.g., 10 seconds) to a higher value like 240 seconds (4 minutes). This ensures the JCPs are fully available before the agents attempt to connect.