From 2748681647e1c5ab5f2ce12c6273e7c5c79d2589 Mon Sep 17 00:00:00 2001 From: Gabriel Aszalos Date: Fri, 1 Jun 2018 09:32:18 +0200 Subject: [PATCH] info: use bind_host when querying /debug/vars This fixes a problem where the `info` command was failing due to a non-standard `bind_host` setting. The `info` command was always attempting to reach the /debug/vars endpoint on `localhost`. This would of course not work when the `bind_host` value was different. Fixes DataDog/dd-agent#3653 --- info/info.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/info/info.go b/info/info.go index a573f87b9..56fbfe784 100644 --- a/info/info.go +++ b/info/info.go @@ -9,7 +9,6 @@ import ( "net/http" "os" "regexp" - "strconv" "strings" "sync" "text/template" @@ -332,7 +331,7 @@ func Info(w io.Writer, conf *config.AgentConfig) error { if host == "0.0.0.0" { host = "127.0.0.1" // [FIXME:christian] not fool-proof } - url := "http://localhost:" + strconv.Itoa(conf.ReceiverPort) + "/debug/vars" + url := fmt.Sprintf("http://%s:%d/debug/vars", conf.ReceiverHost, conf.ReceiverPort) client := http.Client{Timeout: 3 * time.Second} resp, err := client.Get(url) if err != nil {