zeek/scripts/base/frameworks/supervisor/api.zeek
Jon Siwek 297317b232 Organize command-line options for Supervisor filtering/inheritance
Also have stem process execv() with original command-line arguments so
that they're re-parsed and inherited correctly by supervised-nodes in
the event the stem process needs to be re-created.
2020-01-08 14:05:19 -08:00

58 lines
1.5 KiB
Text

##! The Zeek process supervision API.
# TODO: add proper docs
module Supervisor;
export {
type ClusterRole: enum {
NONE,
LOGGER,
MANAGER,
PROXY,
WORKER,
};
type ClusterEndpoint: record {
role: ClusterRole;
host: addr;
p: port;
interface: string &optional;
};
type Node: record {
name: string;
interface: string &optional;
directory: string &optional;
cluster: table[string] of ClusterEndpoint &default=table();
# TODO: separate node config fields from status fields ?
# TODO: add more status fields ?
pid: count &optional;
};
type Status: record {
nodes: table[string] of Node;
};
global status: function(nodes: string &default="all"): Status;
global create: function(node: Node): string;
global destroy: function(nodes: string): bool;
global restart: function(nodes: string &default="all"): bool;
global is_supervisor: function(): bool;
global is_supervised: function(): bool;
global Supervisor::stop_request: event();
global Supervisor::status_request: event(reqid: string, nodes: string);
global Supervisor::status_response: event(reqid: string, result: Status);
global Supervisor::create_request: event(reqid: string, node: Node);
global Supervisor::create_response: event(reqid: string, result: string);
global Supervisor::destroy_request: event(reqid: string, nodes: string);
global Supervisor::destroy_response: event(reqid: string, result: bool);
global Supervisor::restart_request: event(reqid: string, nodes: string);
global Supervisor::restart_response: event(reqid: string, result: bool);
}