base/frameworks/supervisor/control.zeek

SupervisorControl

The Zeek process supervision (remote) control API. This defines a Broker topic prefix and events that can be used to control an external Zeek supervisor process. This API was introduced in Zeek 3.1.0 and considered unstable until 4.0.0. That is, it may change in various incompatible ways without warning or deprecation until the stable 4.0.0 release.

Namespace

SupervisorControl

Imports

base/frameworks/broker, base/frameworks/supervisor/api.zeek

Summary

Redefinable Options

SupervisorControl::enable_listen: bool &redef

When enabled, the Supervisor will listen on the configured Broker Broker::default_listen_address.

SupervisorControl::topic_prefix: string &redef

The Broker topic prefix to use when subscribing to Supervisor API requests and when publishing Supervisor API responses.

Events

SupervisorControl::create_request: event

Send a request to a remote Supervisor process to create a node.

SupervisorControl::create_response: event

Handle a response from a Supervisor process that received SupervisorControl::create_request.

SupervisorControl::destroy_request: event

Send a request to a remote Supervisor process to destroy a node.

SupervisorControl::destroy_response: event

Handle a response from a Supervisor process that received SupervisorControl::destroy_request.

SupervisorControl::node_status: event

A notification event the Supervisor generates when it receives a status message update from the stem, indicating node has (re-)started.

SupervisorControl::restart_request: event

Send a request to a remote Supervisor process to restart a node.

SupervisorControl::restart_response: event

Handle a response from a Supervisor process that received SupervisorControl::restart_request.

SupervisorControl::status_request: event

Send a request to a remote Supervisor process to retrieve node status.

SupervisorControl::status_response: event

Handle a response from a Supervisor process that received SupervisorControl::status_request.

SupervisorControl::stop_request: event

Send a request to a remote Supervisor to stop and shutdown its process tree.

Detailed Interface

Redefinable Options

SupervisorControl::enable_listen
Type

bool

Attributes

&redef

Default

F

Redefinition

from policy/frameworks/management/agent/boot.zeek

=:

T

When enabled, the Supervisor will listen on the configured Broker Broker::default_listen_address.

SupervisorControl::topic_prefix
Type

string

Attributes

&redef

Default

"zeek/supervisor"

The Broker topic prefix to use when subscribing to Supervisor API requests and when publishing Supervisor API responses. If you are publishing Supervisor requests, this is also the prefix string to use for their topic names.

Events

SupervisorControl::create_request
Type

event (reqid: string, node: Supervisor::NodeConfig)

Send a request to a remote Supervisor process to create a node.

Parameters
  • reqid – an arbitrary string that will be directly echoed in the response

  • node – the desired configuration for the new supervised node process.

SupervisorControl::create_response
Type

event (reqid: string, result: string)

Handle a response from a Supervisor process that received SupervisorControl::create_request.

Parameters
  • reqid – an arbitrary string matching the value in the original request.

  • result – the return value of the remote call to Supervisor::create.

SupervisorControl::destroy_request
Type

event (reqid: string, node: string)

Send a request to a remote Supervisor process to destroy a node.

Parameters
  • reqid – an arbitrary string that will be directly echoed in the response

  • node – the name of the node to destroy or empty string to mean “all nodes”.

SupervisorControl::destroy_response
Type

event (reqid: string, result: bool)

Handle a response from a Supervisor process that received SupervisorControl::destroy_request.

Parameters
  • reqid – an arbitrary string matching the value in the original request.

  • result – the return value of the remote call to Supervisor::destroy.

SupervisorControl::node_status
Type

event (node: string, pid: count)

A notification event the Supervisor generates when it receives a status message update from the stem, indicating node has (re-)started. This is the remote equivalent of Supervisor::node_status.

Parameters
  • node – the name of a previously created node via Supervisor::create indicating to which child process the stdout line is associated.

  • pid – the process ID the stem reported for this node.

SupervisorControl::restart_request
Type

event (reqid: string, node: string)

Send a request to a remote Supervisor process to restart a node.

Parameters
  • reqid – an arbitrary string that will be directly echoed in the response

  • node – the name of the node to restart or empty string to mean “all nodes”.

SupervisorControl::restart_response
Type

event (reqid: string, result: bool)

Handle a response from a Supervisor process that received SupervisorControl::restart_request.

Parameters
  • reqid – an arbitrary string matching the value in the original request.

  • result – the return value of the remote call to Supervisor::restart.

SupervisorControl::status_request
Type

event (reqid: string, node: string)

Send a request to a remote Supervisor process to retrieve node status.

Parameters
  • reqid – an arbitrary string that will be directly echoed in the response

  • node – the name of the node to get status of or empty string to mean “all nodes”.

SupervisorControl::status_response
Type

event (reqid: string, result: Supervisor::Status)

Handle a response from a Supervisor process that received SupervisorControl::status_request.

Parameters
  • reqid – an arbitrary string matching the value in the original request.

  • result – the return value of the remote call to Supervisor::status.

SupervisorControl::stop_request
Type

event ()

Send a request to a remote Supervisor to stop and shutdown its process tree. There is no response to this message as the Supervisor simply terminates on receipt.