NevisAgentDataSink
The NevisAgentDataSink
sends scripts to NevisAgent, commands the agent to execute the scripts, and analyzes the script execution result.
During initialisation (init), the NevisAgentDataSink
tries to send all scripts to the NevisAgent. If the delivery fails at init, the data sink will try one more time during export. Once all scripts are available in the agent, the data sink sends a command execution request to the agent, and the agent executes it locally. The agent replies the data sink with execution output and exit status. The user could define the acceptable output format and exit status in the configuration xml-file. If the data sink detects any inconsistency, it reports an error and terminates the export.
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
command | required: paraVal default: none type: string | Defines which command of the command set to be executed. |
url | required: paraVal default: none type: http URI | Defines the URL of the agent. |
connectionPool | required: paraVal default: none type: org.apache.http.client.HttpClient | A reference to an org.apache.http.client.HttpClient object. It refers to either an HttpConnectionPool defined in some initialization section of the configuration file, or to an HttpClient provided programmatically by the client application that is put into the configuration repository. |
user | optional: paraVal default: none type: string | Defines the owner of the script in the agent. |
group | optional: paraVal default: none type: string | Defines the owner's group of the script. |
mask | optional: paraVal default: 700 type: string | Defines the mask of the script's permission mode. |
commandSet | required: paraMap default: none type: A map of key-value pairs denoting all the commands. The key is the name of a command. The details of the command are described using a map. The structure of the map is defined in the next table. | Defines a set of commands the agent could execute. |
Name | Type, usage constraints, defaults | Description |
---|---|---|
cmd | required: value default: none type: path to the script | Defines the name of script to be sent to the agent. |
args | optional: list default: none type: java.util.List | Defines the list of arguments when executing the command. |
dest | required: value default: none type: string | Defines the destination path and script name in the agent. |
ret | optional: value default: 0 type: string | Defines the expected exit value of the script execution. |
output | optional: value default: none type: string | Defines the regular expression of the script execution output. |
Example
Put a script in NevisAgent and execute the script.
<dataSink type="NevisAgentDataSink">
<dp:paraVal name="url" value="${cfg.nevisAgent}"/>
<dp:paraVal name="connectionPool" value="${inst.httpConnection}"/>
<dp:paraVal name="command" value="cmd0"/>
<dp:paraMap name="commandSet">
<map name="cmd0">
<value name="cmd" value="run.sh"/>
<value name="dest" value="/tmp/run.sh"/>
</map>
</dp:paraMap>
</dataSink>
Define a set of commands, and select the command to execute according to the input value.
<dataSink type="NevisAgentDataSink">
<dp:paraVal name="url" value="${cfg.nevisAgent}"/>
<dp:paraVal name="connectionPool" value="${inst.httpConnection}"/>
<dp:paraVal name="command" value="#{in.test.ctrl}"/>
<dp:paraMap name="commandSet">
<map name="ctrl0">
<value name="cmd" value="run.sh"/>
<value name="dest" value="/tmp/run.sh"/>
</map>
<map name="ctrl1">
<value name="cmd" value="sit.sh"/>
<value name="dest" value="/tmp/sit.sh"/>
<value name="ret" value="-1"/>
</map>
<map name="ctrl2">
<value name="cmd" value="walk.sh"/>
<value name="dest" value="/tmp/walk.sh"/>
</map>
</dp:paraMap>
</dataSink>