Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make listen interface of exporters configurable #2495

Closed
wants to merge 8 commits into from
7 changes: 4 additions & 3 deletions managed/services/agents/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// with the basic auth users.
var v2_27_99 = version.MustParse("2.27.99")

func nodeExporterConfig(node *models.Node, exporter *models.Agent, agentVersion *version.Parsed) (*agentpb.SetStateRequest_AgentProcess, error) {
func nodeExporterConfig(node *models.Node, exporter *models.Agent, agentVersion *version.Parsed , listenInterface string) (*agentpb.SetStateRequest_AgentProcess, error) {
tdp := models.TemplateDelimsPair(
pointer.GetString(exporter.MetricsPath),
)
Expand All @@ -44,8 +44,9 @@ func nodeExporterConfig(node *models.Node, exporter *models.Agent, agentVersion

"--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_port " + tdp.Right,
"--web.listen-address=" + listenInterface + ":" + tdp.Left + " .listen_port " + tdp.Right,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be declared here as placeholder, same as .listen_port. And then you pmm-agent should fill it with proper interface. Otherwise it will be the same interface for all nodes.

}

// do not tweak collectors on macOS as many (but not) of them are Linux-specific
if node.Distro != "darwin" {
Expand Down
4 changes: 3 additions & 1 deletion managed/services/agents/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@
return err
}

params, err := nodeExporterConfig(node, row, pmmAgentVersion)
//params, err := nodeExporterConfig(node, row, pmmAgentVersion)
listenInterface := "127.0.0.1" // Change this to the desired IP address or interface
params, err := nodeExporterConfig(node, exporter, agentVersion, listenInterface)

Check failure on line 195 in managed/services/agents/state.go

View workflow job for this annotation

GitHub Actions / Checks

undefined: exporter

Check failure on line 195 in managed/services/agents/state.go

View workflow job for this annotation

GitHub Actions / Checks

undefined: agentVersion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is invalid (uncompilable). It should be row instead of exporter and pmmAgnetVersion instead of agentVersion.

if err != nil {
return err
}
Expand Down
Loading