mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

This is a preliminary implementation of a subset of the functionality set out in our cluster controller architecture. The controller is the central management node, existing once in any Zeek cluster. The agent is a node that runs once per instance, where an instance will commonly be a physical machine. The agent in turn manages the "data cluster", i.e. the traditional notion of a Zeek cluster with manager, worker nodes, etc. Agent and controller live in the policy folder, and are activated when loading policy/frameworks/cluster/agent and policy/frameworks/cluster/controller, respectively. Both run in nodes forked by the supervisor. When Zeek doesn't use the supervisor, they do nothing. Otherwise, boot.zeek instructs the supervisor to create the respective node, running main.zeek. Both controller and agent have their own config.zeek with relevant knobs. For both, controller/types.zeek provides common data types, and controller/log.zeek provides basic logging (without logger communication -- no such node might exist). A primitive request-tracking abstraction can be found in controller/request.zeek to track outstanding request events and their subsequent responses.
29 lines
836 B
Text
29 lines
836 B
Text
@load ./config
|
|
|
|
event zeek_init()
|
|
{
|
|
if ( ! Supervisor::is_supervisor() )
|
|
return;
|
|
|
|
local epi = ClusterController::endpoint_info();
|
|
local sn = Supervisor::NodeConfig($name=epi$id, $bare_mode=T,
|
|
$scripts=vector("policy/frameworks/cluster/controller/main.zeek"));
|
|
|
|
if ( ClusterController::directory != "" )
|
|
sn$directory = ClusterController::directory;
|
|
if ( ClusterController::stdout_file != "" )
|
|
sn$stdout_file = ClusterController::stdout_file;
|
|
if ( ClusterController::stderr_file != "" )
|
|
sn$stderr_file = ClusterController::stderr_file;
|
|
|
|
# This helps Zeek run controller and agent with a minimal set of scripts.
|
|
sn$env["ZEEK_CLUSTER_MGMT_NODE"] = "CONTROLLER";
|
|
|
|
local res = Supervisor::create(sn);
|
|
|
|
if ( res != "" )
|
|
{
|
|
print(fmt("error: supervisor could not create controller node: %s", res));
|
|
exit(1);
|
|
}
|
|
}
|