Starting Situation
- In a number of situations use of the JOC Cockpit GUI is not applicable, e.g. when automating tasks.
- This includes e.g.
- to check if a Master is up and running or if it is down.
- to identify the active Master in a passive cluster.
Use Cases
Identify the Active Master in a Passive Cluster
PS > $js = Connect-JS -Url http://localhost:4446 -AskForCredentials -Id some-jobscheduler-id PS > $js.Masters | Where-Object { $_.jobschedulerId -eq $js.JobSchedulerId -and $_.state.severity -eq 0 } clusterType : @{_type=PASSIVE; precedence=0} host : apmacwin jobschedulerId : apmacwin_4444 port : 40444 startedAt : 06.08.2020 06:19:45 state : @{_text=RUNNING; severity=0} surveyDate : 10.08.2020 17:05:22 url : http://apmacwin:40444
Explanations:
- Line 1: The Connect-JS cmdlet connects to JOC Cockpit at the given URL and pre-selects the Master specified with the value of the
-Id
parameter. - Line 2: The return value of the
Connect-JS
cmdlet includes an array of Master instances that are connected to the given JOC Cockpit instance. This return value is piped to theWhere-Object
cmdlet to identify the currently active Master. The result object includes information such as the URL and state of the active Master. - The output of line 2 includes the active Master that is identified by the same JobScheduler ID that was specified for
Connect-JS
and by the attributeseverity=0
.