mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Harden the telemetry manager against unset Telemetry::metrics_address
We populate that address from the ZEEK_DEFAULT_LISTEN_ADDRESS environment variable, but weren't prepared for that not being set. We now fall back to 0.0.0.0. This may have the same IPv6 issues that we've encountered elsewhere when doing so before (v6 interfaces need "::") -- but this is still more likely to work than not having any string at all.
This commit is contained in:
parent
3ecacf4f50
commit
8eb74c04de
1 changed files with 2 additions and 0 deletions
|
@ -36,6 +36,8 @@ void Manager::InitPostScript() {
|
||||||
std::string prometheus_url;
|
std::string prometheus_url;
|
||||||
auto metrics_port = id::find_val("Telemetry::metrics_port")->AsPortVal();
|
auto metrics_port = id::find_val("Telemetry::metrics_port")->AsPortVal();
|
||||||
auto metrics_address = id::find_val("Telemetry::metrics_address")->AsStringVal()->ToStdString();
|
auto metrics_address = id::find_val("Telemetry::metrics_address")->AsStringVal()->ToStdString();
|
||||||
|
if ( metrics_address.empty() )
|
||||||
|
metrics_address = "0.0.0.0";
|
||||||
if ( metrics_port->Port() != 0 )
|
if ( metrics_port->Port() != 0 )
|
||||||
prometheus_url = util::fmt("%s:%u", metrics_address.data(), metrics_port->Port());
|
prometheus_url = util::fmt("%s:%u", metrics_address.data(), metrics_port->Port());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue