Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# common options for connection to JS7 REST API request_options=(--url=http://localhost:4446 --user=root --password=root) # get status information for indicated Standalone Agents response=$(./operate-joc.sh status-agent "${request_options[@]}") --controller-id=controller --agent-id=agent_001,agent_002) # returns response {"agents":[{"agentId":"agent_001","agentName":"primaryAgent","controllerId":"testsuite","disabled":false,"healthState":{"_text":"ALL_SUBAGENTS_ARE_COUPLED_AND_ENABLED","severity":0},"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"url":"https://agent-2-0-primary:4443","version":"2.7.2-SNAPSHOT"},{"agentId":"agent_002","agentName":"secondaryAgent","controllerId":"testsuite","disabled":false,"healthState":{"_text":"ALL_SUBAGENTS_ARE_COUPLED_AND_ENABLED","severity":0},"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"url":"https://agent-2-0-secondary:4443","version":"2.7.2-SNAPSHOT"}],"deliveryDate":"2024-11-11T18:45:28.855Z","surveyDate":"2024-11-11T18:45:06.798Z"} # read severity from response echo "$response" | jq -r '.agents[0].state.severity // empty' # get status information for Agent Cluster response=$(./operate-joc.sh status-agent "${request_options[@]}") --controller-id=controller --agent-cluster) # returns response {"agents":[{"agentId":"agent_cluster_001","agentName":"AgentCluster001","clusterState":{"_text":"ClusterCoupled","severity":0},"controllerId":"testsuite","healthState":{"_text":"ALL_SUBAGENTS_ARE_COUPLED_AND_ENABLED","severity":0},"runningTasks":0,"subagents":[{"agentId":"agent_cluster_001","disabled":false,"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"subagentId":"director_primary_001","url":"https://diragent-2-0-primary:4443","version":"2.7.2-SNAPSHOT","clusterNodeState":{"_text":"active","severity":0},"isDirector":"PRIMARY_DIRECTOR"},{"agentId":"agent_cluster_001","disabled":false,"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"subagentId":"director_secondary_001","url":"https://diragent-2-0-secondary:4443","version":"2.7.2-SNAPSHOT","clusterNodeState":{"_text":"inactive","severity":1},"isDirector":"SECONDARY_DIRECTOR"},{"agentId":"agent_cluster_001","disabled":false,"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"subagentId":"subagent_primary_001","url":"https://subagent-2-0-primary:4443","version":"2.7.2-SNAPSHOT","isDirector":"NO_DIRECTOR"},{"agentId":"agent_cluster_001","disabled":false,"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"subagentId":"subagent_secondary_001","url":"https://subagent-2-0-secondary:4443","version":"2.7.2-SNAPSHOT","isDirector":"NO_DIRECTOR"},{"agentId":"agent_cluster_001","disabled":false,"runningTasks":0,"state":{"_text":"COUPLED","severity":0},"subagentId":"subagent_third_001","url":"https://subagent-2-0-third:4443","version":"2.7.2-SNAPSHOT","isDirector":"NO_DIRECTOR"}]}]} # reads cluster state from status information echo "$response" | jq -r '.agents[0].clusterState.severity // empty' # reads Primary and Secondary Director Agent component state echo "$response" | jq -r '.agents[0].subagents[0].state.severity // empty' echo "$response" | jq -r '.agents[0].subagents[1].state.severity // empty' # reads Primary and Secondary Director Agent cluster node state echo "$response" | jq -r '.agents[0].subagents[0].clusterNodeState.severity // empty' echo "$response" | jq -r '.agents[0].subagents[1].clusterNodeState.severity // empty' |
...
Overview
Content Tools