Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: Uses selection criteria to retrieve the agents of an AgentGroup objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task and provides the result for further processing in the form of an internal listShows entities in a grid view (data sequenceAn internal listing of Console outputs or lines of Variable objects, etc. The lines of a data sequence can be accessed by using a PROCESS loop or the script element GET_PROCESS_LINE. The script elements PREP_PROCESS* generate data sequences.).
PREP_PROCESS_AGENTGROUP(AgentGroup, [Host], [Selection option], [RunID])
Return code |
---|
Reference to the data sequence of the AgentGroup object |
This script function reads the agents of an AgentGroup object. These agents can be limited with parameters. By default, the reference to the whole data sequence is returned.
The return codeThe value that represents the result of tasks and script functions. of this script function is the reference to a data sequence. It is assigned to the script statements :PROCESS and :ENDPROCESS as a start parameter. In combination with the script function GET_PROCESS_LINE, it is possible to access each individual line of the data sequence. Data sequences are divided into two columns which can be specifically read:
The statusThis represents the condition of a task (such as active, blocked, generating). is mainly important for agent groups of mode "All". The script function always supplies all agents for such agent groups without consideration of whether they are active or not. The status information can be used to retrieve agents on which tasks can actually be processed.
Commas must always be set even if you search only for the selection and/or the RUN#.
No new value can be assigned to the script variable containing the data sequence reference. The data sequence must first be discarded with the script statement CLOSE_PROCESS and then the variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type. can be re-used.
The first example retrieves all agents of a agent groups whose names start with "WIN".
:SET &HND# = PREP_PROCESS_AGENTGROUP("AGENTGROUP_WINDOWS","WIN*",ALL)
:PROCESS &HND#
: SET &AGENT# = GET_PROCESS_LINE(&HND#,1)
: SET &STATUS# = GET_PROCESS_LINE(&HND#,2)
: PRINT "Agent: &AGENT#"
: PRINT "Status: &STATUS#"
:ENDPROCESS
:CLOSE_PROCESS &HND#
The following example restarts a task. The script function SYS_ACT_ME_NR returns the RUN# of the original execution which can be used to retrieve the RUN# of the agent group Container. Therefore, the agents on which a task had originally run can be retrieved.
:SET &T_RUNNR# = SYS_ACT_ME_NR()
:SET &P_RUNNR# = GET_PARENT_NR(&T_RUNNR#)
:SET &HND# = PREP_PROCESS_AGENTGROUP("AGENTGROUP_DB",,RUNNR,&P_RUNNR#)
:PROCESS &HND#
: SET &AGENT# = GET_PROCESS_LINE(&HND#,1)
: SET &STATUS# = GET_PROCESS_LINE(&HND#,2)
: PRINT "Agent: &AGENT#"
: PRINT "Status: &STATUS#"
:ENDPROCESS
:CLOSE_PROCESS &HND#
See also:
Script element | Description |
---|---|
Discards an unnecessary data sequence |
|
They are used to define a loop for line-by-line processing of data sequences such as the content of a sequential file or the text result of a command. |
|
This is used to retrieve content from the current line of a data sequence. |
Script Element - Data Sequences
About Scripts
Scrip Elements - Alphabetical Listing
Script Elements - Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |