From 05df62c479d4769d439f85f2209007b59677db86 Mon Sep 17 00:00:00 2001 From: Crash129 Date: Tue, 19 May 2020 11:56:23 +0200 Subject: [PATCH 1/3] PMM-5967 Bind-IP for agent listeners --- services/agents/node.go | 2 +- services/agents/node_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/agents/node.go b/services/agents/node.go index 9ca40451a5..1a413e6d9c 100644 --- a/services/agents/node.go +++ b/services/agents/node.go @@ -39,7 +39,7 @@ func nodeExporterConfig(node *models.Node, exporter *models.Agent) *agentpb.SetS "--web.disable-exporter-metrics", // we enable them as a part of HR metrics - "--web.listen-address=:" + tdp.left + " .listen_port " + tdp.right, + "--web.listen-address=" + tdp.left + " .listen_address " + tdp.right + ":" + tdp.left + " .listen_port " + tdp.right, } // do not tweak collectors on macOS as many (but not) of them are Linux-specific diff --git a/services/agents/node_test.go b/services/agents/node_test.go index 96d87605ae..47f0c900c9 100644 --- a/services/agents/node_test.go +++ b/services/agents/node_test.go @@ -101,7 +101,7 @@ func TestNodeExporterConfig(t *testing.T) { "--no-collector.xfs", "--no-collector.zfs", "--web.disable-exporter-metrics", - "--web.listen-address=:{{ .listen_port }}", + "--web.listen-address={{ .listen_address }}:{{ .listen_port }}", }, Env: []string{ "HTTP_AUTH=pmm:agent-id", From ce131a3b806eb9fe3d26407aab76f4dcda1db1e5 Mon Sep 17 00:00:00 2001 From: Crash129 Date: Wed, 20 May 2020 20:30:37 +0200 Subject: [PATCH 2/3] PMM-5967 Bind-IP for agent listeners --- services/agents/node_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/agents/node_test.go b/services/agents/node_test.go index 47f0c900c9..86823d0c3b 100644 --- a/services/agents/node_test.go +++ b/services/agents/node_test.go @@ -130,7 +130,7 @@ func TestNodeExporterConfig(t *testing.T) { "--collector.textfile.directory.lr=/usr/local/percona/pmm2/collectors/textfile-collector/low-resolution", "--collector.textfile.directory.mr=/usr/local/percona/pmm2/collectors/textfile-collector/medium-resolution", "--web.disable-exporter-metrics", - "--web.listen-address=:{{ .listen_port }}", + "--web.listen-address={{ .listen_address }}:{{ .listen_port }}", }, Env: []string{ "HTTP_AUTH=pmm:agent-id", From e82c7b48d9f30094ae1fc657daa4b1aa99e4db8d Mon Sep 17 00:00:00 2001 From: Crash129 Date: Tue, 25 Aug 2020 10:29:09 +0200 Subject: [PATCH 3/3] PMM-5967 Bind-IP for agent listeners added "with" check for .listen_address in node exporter arg templates --- services/agents/node.go | 4 +++- services/agents/node_test.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/agents/node.go b/services/agents/node.go index 1a413e6d9c..082c803b1a 100644 --- a/services/agents/node.go +++ b/services/agents/node.go @@ -39,7 +39,9 @@ func nodeExporterConfig(node *models.Node, exporter *models.Agent) *agentpb.SetS "--web.disable-exporter-metrics", // we enable them as a part of HR metrics - "--web.listen-address=" + tdp.left + " .listen_address " + tdp.right + ":" + tdp.left + " .listen_port " + tdp.right, + "--web.listen-address=" + + tdp.left + " with .listen_address " + tdp.right + tdp.left + " . " + tdp.right + tdp.left + " end " + tdp.right + + ":" + tdp.left + " .listen_port " + tdp.right, } // do not tweak collectors on macOS as many (but not) of them are Linux-specific diff --git a/services/agents/node_test.go b/services/agents/node_test.go index 86823d0c3b..57c853ea5b 100644 --- a/services/agents/node_test.go +++ b/services/agents/node_test.go @@ -101,7 +101,7 @@ func TestNodeExporterConfig(t *testing.T) { "--no-collector.xfs", "--no-collector.zfs", "--web.disable-exporter-metrics", - "--web.listen-address={{ .listen_address }}:{{ .listen_port }}", + "--web.listen-address={{ with .listen_address }}{{ . }}{{ end }}:{{ .listen_port }}", }, Env: []string{ "HTTP_AUTH=pmm:agent-id", @@ -130,7 +130,7 @@ func TestNodeExporterConfig(t *testing.T) { "--collector.textfile.directory.lr=/usr/local/percona/pmm2/collectors/textfile-collector/low-resolution", "--collector.textfile.directory.mr=/usr/local/percona/pmm2/collectors/textfile-collector/medium-resolution", "--web.disable-exporter-metrics", - "--web.listen-address={{ .listen_address }}:{{ .listen_port }}", + "--web.listen-address={{ with .listen_address }}{{ . }}{{ end }}:{{ .listen_port }}", }, Env: []string{ "HTTP_AUTH=pmm:agent-id",