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.
Versions: 21.0 and higher
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:
To resolve this issue, you must ensure the agent is active and correctly defined in the Agent Group.
Verify Agent Status:
Verify Agent Group Configuration:
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: