From 637081f03683a3f6b9fc444d0985f0ac8f60819d Mon Sep 17 00:00:00 2001 From: simitt Date: Thu, 15 Apr 2021 17:12:42 +0200 Subject: [PATCH 1/2] [elastic-agent] respect host configuration for http endpoint When http processes endpoint is enabled, do not hardcode http endpoint to localhost. This would not work for docker environments. --- x-pack/elastic-agent/pkg/core/monitoring/beats/monitoring.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/elastic-agent/pkg/core/monitoring/beats/monitoring.go b/x-pack/elastic-agent/pkg/core/monitoring/beats/monitoring.go index 6aa6c471e79..240ce5adbb2 100644 --- a/x-pack/elastic-agent/pkg/core/monitoring/beats/monitoring.go +++ b/x-pack/elastic-agent/pkg/core/monitoring/beats/monitoring.go @@ -26,7 +26,7 @@ const ( // args: pipeline name, application name agentMbEndpointFileFormatWin = `npipe:///elastic-agent` // agentMbEndpointHTTP is used with cloud and exposes metrics on http endpoint - agentMbEndpointHTTP = "http://localhost:%d" + agentMbEndpointHTTP = "http://%s:%d" ) // MonitoringEndpoint is an endpoint where process is exposing its metrics. @@ -60,7 +60,7 @@ func getLoggingFile(spec program.Spec, operatingSystem, installPath, pipelineID // AgentMonitoringEndpoint returns endpoint with exposed metrics for agent. func AgentMonitoringEndpoint(operatingSystem string, cfg *monitoringConfig.MonitoringHTTPConfig) string { if cfg != nil && cfg.Enabled { - return fmt.Sprintf(agentMbEndpointHTTP, cfg.Port) + return fmt.Sprintf(agentMbEndpointHTTP, cfg.Host, cfg.Port) } if operatingSystem == "windows" { From 2acfc6fe911b1eb2d45e0925ceff2be536caf1a6 Mon Sep 17 00:00:00 2001 From: simitt Date: Thu, 15 Apr 2021 20:49:59 +0200 Subject: [PATCH 2/2] Add changelog --- x-pack/elastic-agent/CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index 0a0b5ae7548..8481d569a05 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -49,6 +49,7 @@ - Add support for filestream input. {pull}24820[24820] - Add check for URL set when cert and cert key. {pull}24904[24904] - Fix install command for Fleet Server bootstrap, remove need for --enrollment-token when using --fleet-server {pull}24981[24981] +- Respect host configuration for exposed processes endpoint {pull}25114[25114] ==== New features