Page History
Table of Contents |
---|
Introduction
For JS7 - Management of Standalone Agents a number of allows users wish to create Agents automatically from individual sources such as a database.
- The JS7 - REST Web Service API allows to perform the same Agent management operations to manage Agents as offered be performed as are available from the JOC Cockpit GUI.
- See the Technical Documentation of the REST Web Service API article for detailed information.
- The JS7 - PowerShell Module offers allows simplified access to the REST Web Service API for scripting purposes.
- The Executing the PowerShell examples when executed provided here might prove to be instructive for the logging of REST API calls when used with the
-debug
option.
- The Executing the PowerShell examples when executed provided here might prove to be instructive for the logging of REST API calls when used with the
Documentation
The REST Web Service API provides the functionality can be used to automate operation of JS7 operation.
To add the REST Web Service API calls in your preferred language or to use the PowerShell cmdlets, refer to:
- find the Technical Documentation of the REST Web Service API
find the documentation for PowerShell CLI 2.0 - Cmdlets - Agent Management
Examples
The following examples makes use of the JS7 PowerShell Module to manage Standalone Agents:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/usr/bin/env pwsh # Parameterization $Url = "http://localhost:4446" $ControllerId = "controller" $TestCaseAgentId = "TestCase_AgentID" $TestCaseAgentName = "TestCase_AgentName" $TestCaseAgentUrl = "http://TestCase_AgentUrl" # Connection Import-Module JS7 -Force Connect-JS7 -Url $Url -Id $ControllerId | Out-Null # ----- createCreate Standalone Agents ----- # store Agent configuration to inventory Set-JS7Agent -AgentId "$TestCaseAgentId-001" -AgentName "$TestCaseAgentName-001" -Url "$TestCaseAgentUrl-001:4443" -ControllerId $ControllerId Set-JS7Agent -AgentId "$TestCaseAgentId-002" -AgentName "$TestCaseAgentName-002" -Url "$TestCaseAgentUrl-002:4443" -ControllerId $ControllerId # ----- manageManage Standalone Agents ----- # storeread Agent configurations tofrom inventory $agent1 = Get-JS7Agent -AgentId "$TestCaseAgentId-001" $agent2 = Get-JS7Agent -AgentId "$TestCaseAgentId-002" # deploy Agents to Controller Publish-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # reset Agents if required Reset-JS7Agent -AgentId "$TestCaseAgentId-001" Reset-JS7Agent -AgentId "$TestCaseAgentId-001" -Force # disable Agents that should not be considered for job execution Disable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # hide Agents that should not be considered for assignment to jobs Hide-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # make hidden Agents visible again Show-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # enable Agents Enable-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # ----- removeRemove Standalone Agents ----- Remove-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # Connection Disconnect-JS7 |
...
- Line 1: A shebang is used to invoke PowerShell on Unix platforms. For Windows platforms replace this line with:
@@findstr
/v
"^@@f.*&"
"%~f0"
|pwsh.exe -&goto:eof
- Optionally adjust
pwsh.exe
bypowershell.exe
or similar to locate the PowerShell interpreter.
- Line 5: The URL to JOC Cockpit is specified. This is the same URL as used from a user client browser to access JOC Cockpit.
- Line 6: The Controller ID is specified during setup of a Controller. Find the The Controller ID can be found in the upper right upper hand corner of any JOC Cockpit page.
...
Overview
Content Tools