Introduction
For JS7 - Management of Standalone Agents a number of users wish to create Agents automatically from individual sources such as a database.
- The JS7 - REST Web Service API allows to perform the same operations to manage Agents as offered from the JOC Cockpit GUI.
- The JS7 - PowerShell Module offers simplified access to the REST Web Service API for scripting purposes.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when used with the
-debug
option.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when used with the
Documentation
The REST Web Service API provides the functionality to automate JS7 operation.
To add the REST Web Service API calls in your preferred language or to use the PowerShell cmdlets
- 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:
Example for use of PowerShell cmdlets
#!/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 # ----- create Standalone Agents ----- 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 # ----- manage Standalone Agents ----- # store Agent configurations to 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" # ----- remove Standalone Agents ----- Remove-JS7Agent -AgentId "$TestCaseAgentId-001","$TestCaseAgentId-002" # Connection Disconnect-JS7
Explanation:
- 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 browser to access JOC Cockpit.
- Line 6: The Controller ID is specified during setup of a Controller. Find the Controller ID in the right upper corner of any JOC Cockpit page.
Overview
Content Tools