diff --git a/scripts/base/frameworks/supervisor/control.zeek b/scripts/base/frameworks/supervisor/control.zeek index fa20a9dba6..ed9c083cb9 100644 --- a/scripts/base/frameworks/supervisor/control.zeek +++ b/scripts/base/frameworks/supervisor/control.zeek @@ -4,6 +4,7 @@ ##! That is, it may change in various incompatible ways without warning or ##! deprecation until the stable 4.0.0 release. +@load base/frameworks/broker @load ./api module SupervisorControl; @@ -15,6 +16,10 @@ export { ## for their topic names. const topic_prefix = "zeek/supervisor" &redef; + ## When enabled, the Supervisor will listen on the configured Broker + ## :zeek:see:`Broker::default_listen_address`. + const enable_listen = F &redef; + ## Send a request to a remote Supervisor process to create a node. ## ## reqid: an arbitrary string that will be directly echoed in the response diff --git a/scripts/base/frameworks/supervisor/main.zeek b/scripts/base/frameworks/supervisor/main.zeek index f892907055..8b0161b79e 100644 --- a/scripts/base/frameworks/supervisor/main.zeek +++ b/scripts/base/frameworks/supervisor/main.zeek @@ -3,7 +3,6 @@ @load ./api @load ./control -@load base/frameworks/broker function Supervisor::status(node: string): Supervisor::Status { @@ -42,6 +41,13 @@ function Supervisor::node(): Supervisor::NodeConfig event zeek_init() &priority=10 { + if ( Supervisor::is_supervisor() && SupervisorControl::enable_listen ) + { + Broker::listen(Broker::default_listen_address, + Broker::default_port, + Broker::default_listen_retry); + } + Broker::subscribe(SupervisorControl::topic_prefix); }