Add ClusterController::API::get_nodes_request/response event pair

This allows querying the status of Zeek nodes currently running in a cluster.
The controller relays the request to all instances and accumulates their
responses.

The response back to the client contains one Result record per instance
response, each of which carrying a ClusterController::Types::NodeState vector in
its $data member to convey the state of each node at that instance.

The NodeState record tracks the name of the node, its role in the controller (if
any), its role in the data cluster (if any), as well as PID and listening port,
if any.
This commit is contained in:
Christian Kreibich 2022-01-31 17:51:33 -08:00
parent 791e5545b1
commit 7db8634c8b
5 changed files with 272 additions and 12 deletions

View file

@ -13,7 +13,6 @@ export {
## controller and agent.
const version = 1;
# Agent API events
## The controller sends this event to convey a new cluster configuration
@ -42,6 +41,28 @@ export {
result: ClusterController::Types::Result);
## The controller sends this event to request a list of
## :zeek:see:`ClusterController::Types::NodeStatus` records that capture
## the status of Supervisor-managed nodes running on this instance.
## instances.
##
## reqid: a request identifier string, echoed in the response event.
##
global get_nodes_request: event(reqid: string);
## Response to a get_nodes_request event. The agent sends this back to the
## controller.
##
## reqid: the request identifier used in the request event.
##
## result: a :zeek:see:`ClusterController::Types::Result` record. Its data
## member is a vector of :zeek:see:`ClusterController::Types::NodeState`
## records, covering the nodes at this instance. The result may also
## indicate failure, with error messages indicating what went wrong.
##
global get_nodes_response: event(reqid: string,
result: ClusterController::Types::Result);
## The controller sends this event to confirm to the agent that it is
## part of the current cluster topology. The agent acknowledges with the
## corresponding response event.