Skip to content

Commit

Permalink
added a feature which will make the listen interface configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwas-sharma2480 committed Sep 20, 2023
1 parent 573e061 commit 3cb5e7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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,
}

// 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 @@ func (u *StateUpdater) sendSetStateRequest(ctx context.Context, agent *pmmAgentI
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
if err != nil {
return err
}
Expand Down

0 comments on commit 3cb5e7d

Please sign in to comment.