Introduction
JS7 - Management of Standalone Agents allows users to create Agents automatically from individual sources such as a database.
- The JS7 - REST Web Service API allows the same Agent management operations to be performed as are available from the JOC Cockpit GUI.
- The JS7 - PowerShell Module allows simplified access to the REST Web Service API for scripting purposes.
- Executing the PowerShell examples provided here might prove to be instructive for the logging of REST API calls when used with the
-debug
option.
- Executing the PowerShell examples provided here might prove to be instructive for the logging of REST API calls when used with the
Documentation
The REST Web Service API can be used to automate operation of JS7.
To add REST Web Service API calls in your preferred language or to use the PowerShell cmdlets, refer to:
- the Technical Documentation of the REST Web Service API
the documentation for PowerShell CLI 2.0 - Cmdlets - Agent Management
Examples
The following examples use 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 ----- # 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 # ----- Manage Standalone Agents ----- # read Agent configurations from 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 client 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