mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Management framework: improve address and port handling
The get-nodes command also benefits from showing the state on connected agents more broadly (as opposed to just the one for the current configuration). Also a bugfix: ensure we use an agent's IP address as seen by the controller. This avoids reporting "0.0.0.0" in some cases.
This commit is contained in:
parent
0c47d45bb9
commit
c53044981a
1 changed files with 11 additions and 9 deletions
|
@ -175,10 +175,15 @@ function add_instance(inst: Management::Instance)
|
||||||
|
|
||||||
if ( inst$name in g_instances_known )
|
if ( inst$name in g_instances_known )
|
||||||
{
|
{
|
||||||
# The agent has already peered with us. Send welcome to indicate
|
# The agent has already peered with us. This means we have its
|
||||||
# it's part of cluster management. Once it responds, we update
|
# IP address as observed by us, so use it if this agent
|
||||||
# the set of ready instances and proceed as feasible with config
|
# connected to us.
|
||||||
# deployments.
|
if ( ! inst?$listen_port )
|
||||||
|
inst$host = g_instances_known[inst$name]$host;
|
||||||
|
|
||||||
|
# Send welcome to indicate it's part of cluster management. Once
|
||||||
|
# it responds, we update the set of ready instances and proceed
|
||||||
|
# as feasible with config deployments.
|
||||||
|
|
||||||
local req = Management::Request::create();
|
local req = Management::Request::create();
|
||||||
|
|
||||||
|
@ -665,7 +670,7 @@ event Management::Controller::API::get_nodes_request(reqid: string)
|
||||||
Management::Log::info(fmt("rx Management::Controller::API::get_nodes_request %s", reqid));
|
Management::Log::info(fmt("rx Management::Controller::API::get_nodes_request %s", reqid));
|
||||||
|
|
||||||
# Special case: if we have no instances, respond right away.
|
# Special case: if we have no instances, respond right away.
|
||||||
if ( |g_instances| == 0 )
|
if ( |g_instances_known| == 0 )
|
||||||
{
|
{
|
||||||
Management::Log::info(fmt("tx Management::Controller::API::get_nodes_response %s", reqid));
|
Management::Log::info(fmt("tx Management::Controller::API::get_nodes_response %s", reqid));
|
||||||
local res = Management::Result($reqid=reqid, $success=F,
|
local res = Management::Result($reqid=reqid, $success=F,
|
||||||
|
@ -678,11 +683,8 @@ event Management::Controller::API::get_nodes_request(reqid: string)
|
||||||
local req = Management::Request::create(reqid);
|
local req = Management::Request::create(reqid);
|
||||||
req$get_nodes_state = GetNodesState();
|
req$get_nodes_state = GetNodesState();
|
||||||
|
|
||||||
for ( name in g_instances )
|
for ( name in g_instances_known )
|
||||||
{
|
{
|
||||||
if ( name !in g_instances_ready )
|
|
||||||
next;
|
|
||||||
|
|
||||||
local agent_topic = Management::Agent::topic_prefix + "/" + name;
|
local agent_topic = Management::Agent::topic_prefix + "/" + name;
|
||||||
local areq = Management::Request::create();
|
local areq = Management::Request::create();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue