Create an SSH activity
Create an activity that extracts data from a target host that uses the SSH network protocol.
始める前に
Role required: activity_creator or workflow_admin
このタスクについて
For instructions on using the activity template process flow, see create custom activities.
手順
Advanced SSH script options
To run a MID Server script on
the target host, specify the script type and pass the name of the script into the
${syncFile()} parameter. The system uses this parameter to
locate the named script in the MID Server Script File [ecc_agent_script_file] table
and run it on the target host. For example, a bash script can be expressed as:
bash ${syncFile("<MID script name>")} argument1 argument2 argument3A base script (
main_script.bash) can reference another script
(my_include.bash) as well as a separate file
(.my_profile) located on the target host. Both scripts and the
file referenced must be synced to the MID Server, using the
${syncFile()} parameter, to execute
properly.source ${syncFile(".my_profile")}
cp ${syncFile("my_include.bash")} /usr/ssmith/my_include.bash
bash ${syncFile("main_script.bash")} one two three four five six
rm /usr/ssmith/my_include.bashA Python example with inline comments might look like this:
set $LIB_DIR=/usr/bin;.
# Sync a file that is referenced inside myF5CreateLBPool.py
cp ${syncFile("specialFunctions.py")} ~/specialFunctions.py
# set up environment variables
source ${syncFile(".python_profile")}
# call script that sets up dependencies on the box from remote package repos
python ${syncFile("setupPythonDependencies.py")} pycontrol
# call a script that requires functions from the package as well as a function from myIncludedFile
python ${syncFile("myF5CreateLBPool.py")} snow_pool myActualValue
# user is responsible for their own cleanup
rm ~/specialFunctions.py 次のタスク
- Use auto-mapping to generate outputs and parsing rules
- If you do not use auto-mapping, you can manually create output variables and create parsing rules
SSH template execution parameters
Use execution parameters to create the input process script in the Pre Processing form of the activity designer.
For descriptions of the command fields, see Configure the SSH execution command.
注:
You must use the
executionParam. prefix with all variables in
this table.| Name | Variable | Type | Usage |
|---|---|---|---|
| Source | source | String | Intended target or host. |
| Command | command | String | Comment to run on the host. |
| Directory | directory | String | Directory on the host in which to run the command. |
| Credential tag | credential_tag | String | Orchestration credential tag to use when running the command. |
| MidCapabilities | midCapabilities | String (comma separated) | List of required MID Server capabilities. |
| ValueCapabilities | valueCapabilities | Array of hashmap | Capability values used to select the MID Server. For more information, see
MID Server capabilities. If there are additional capabilities that are assigned by value, use this
example to customize the MID Server
selection: |
| Long running | long_running | Boolean | Indicates whether or not the command is long running. A value of true indicates that the command is long running. |
| Must sudo | must_sudo | Boolean | Indicates whether or not this activity must use sudo to run root commands. A value of true indicates that sudo SSH credentials must be used. |
SSH post-processing parameters and payload parsing
Use these parameters to create a post-processing script, payload parsing, and tagging.
| Name | Variable | Type | Usage |
|---|---|---|---|
| Output | output | String | Contains the output returned from the SSH command. |
| EccSysID | eccSysID | String | Contains the reference ID associated with the ECC Queue input message returned by the activity. |
| ErrorMessages | errorMessages | String | Contains the error messages retrieved from the SSH command. This value is null if there are no error messages. |
| Tags | tags | Hashmap of tag values returned from the SSH command | Contains the tags used to extract output using the SSH commands. The tag
output is delimited by double percentage signs, as in %%tagname%% …
%%. Set up the command using the following
format:The
tags returned are JavaScript hashmap objects in which each key is prefixed with
tag appended with the
tagname. |
Configure the SSH execution command
Use the input variables you created to configure the command that Orchestration executes on the host target.
始める前に
Role required: activity_creator, admin
注:
You can test the SSH connection between the MID
Server and the target without having to run the acvitity in a workflow context. For
details, see test template outputs.