Introduce metrics_port to supervisor and management framework.

This only adds the port value in the various required places. Its actual use
follows in the next commits.
This commit is contained in:
Christian Kreibich 2024-03-22 19:29:17 -07:00
parent 9e3c3b6923
commit 4e862cae9a
5 changed files with 37 additions and 0 deletions

View file

@ -30,6 +30,8 @@ export {
## The PCAP file name from which the node will read/analyze packets.
## Typically used by worker nodes.
pcap_file: string &optional;
## The TCP port at which the cluster node exposes metrics for Prometheus.
metrics_port: port &optional;
};
## Configuration options that influence behavior of a supervised Zeek node.

View file

@ -521,6 +521,9 @@ function deploy_request_finish(areq: Management::Request::Request)
if ( node?$interface )
cep$interface = node$interface;
if ( node?$metrics_port )
cep$metrics_port = node$metrics_port;
g_cluster[node$name] = cep;
}
@ -630,6 +633,9 @@ function get_nodes_request_finish(areq: Management::Request::Request)
# serialization always assumes TCP.
if ( sns$node$cluster[node]$p != 0/tcp )
cns$p = sns$node$cluster[node]$p;
if ( sns$node$cluster[node]?$metrics_port )
cns$metrics_port = sns$node$cluster[node]$metrics_port;
}
else
{

View file

@ -60,6 +60,7 @@ export {
interface: string &optional; ##< Interface to sniff
cpu_affinity: int &optional; ##< CPU/core number to pin to
env: table[string] of string &default=table(); ##< Custom environment vars
metrics_port: port &optional; ##< Metrics exposure port for Prometheus
};
## Data structure capturing a cluster's complete configuration.
@ -88,6 +89,8 @@ export {
pid: int &optional;
## The node's Broker peering listening port, if any.
p: port &optional;
## The node's metrics port for Prometheus, if any.
metrics_port: port &optional;
};
type NodeStatusVec: vector of NodeStatus;