mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00

This changes the agent-controller communication to remove the need for ongoing pinging of the controller by agents not actively "in service". Instead, agents now use the notify_agent_hello event to the controller to report only their identity. The controller puts them into service via an agent_welcome_request/ response pair, and takes them out of service via agent_standby_request/response. This removes the on_change handler from the set of agents that is ready for service, because not every change to this set is now a suitable time to potentially send out the configuration. We now invoke this check explicitly in the two situations where it's warranted: when a agent reports ready for service, and when we've received a new configuration.
54 lines
2 KiB
Text
54 lines
2 KiB
Text
@load base/frameworks/supervisor/control
|
|
@load policy/frameworks/cluster/controller/types
|
|
|
|
module ClusterAgent::API;
|
|
|
|
export {
|
|
const version = 1;
|
|
|
|
# Agent API events
|
|
|
|
# The controller uses this event to convey a new cluster
|
|
# configuration to the agent. Once processed, the agent
|
|
# responds with the response event.
|
|
global set_configuration_request: event(reqid: string,
|
|
config: ClusterController::Types::Configuration);
|
|
global set_configuration_response: event(reqid: string,
|
|
result: ClusterController::Types::Result);
|
|
|
|
# The controller uses this event to confirm to the agent
|
|
# that it is part of the current cluster. The agent
|
|
# acknowledges with the response event.
|
|
global agent_welcome_request: event(reqid: string);
|
|
global agent_welcome_response: event(reqid: string,
|
|
result: ClusterController::Types::Result);
|
|
|
|
# The controller sends this event to convey that the agent is not
|
|
# currently required. This status may later change, depending on
|
|
# updates from the client, so the peering can remain active. The
|
|
# agent releases any cluster-related resources when processing the
|
|
# request.
|
|
global agent_standby_request: event(reqid: string);
|
|
global agent_standby_response: event(reqid: string,
|
|
result: ClusterController::Types::Result);
|
|
|
|
# Notification events, agent -> controller
|
|
|
|
# The agent sends this upon peering as a "check in", informing the
|
|
# controller that an agent of the given name is now available to
|
|
# communicate with.
|
|
global notify_agent_hello: event(instance: string, host: addr,
|
|
api_version: count);
|
|
|
|
# Report node state changes.
|
|
global notify_change: event(instance: string,
|
|
n: ClusterController::Types::Node,
|
|
old: ClusterController::Types::State,
|
|
new: ClusterController::Types::State);
|
|
|
|
# Report operational error.
|
|
global notify_error: event(instance: string, msg: string, node: string &default="");
|
|
|
|
# Report informational message.
|
|
global notify_log: event(instance: string, msg: string, node: string &default="");
|
|
}
|