Skip to content
New issue

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

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

Already on GitHub? # to your account

Client V2 must accept config file (at lest in development mode) #43

Open
belimawr opened this issue Oct 14, 2022 · 1 comment
Open

Client V2 must accept config file (at lest in development mode) #43

belimawr opened this issue Oct 14, 2022 · 1 comment
Labels
Team:Elastic-Agent Label for the Agent team

Comments

@belimawr
Copy link
Contributor

The best way to get clients running from a standalone config is via changes to the v2-client, since otherwise we would need to bypass large chunks of control code to get a "standalone mode"

Two non-exclusive ways to do this:

  • Have the connection info for the agent be read over a config file and not stdin
  • Have the client accept a config file with a hard-coded config, and treat that config like it's coming from an elastic-agent server
@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Oct 31, 2022
@cmacknz
Copy link
Member

cmacknz commented Nov 1, 2022

To clarify this issue is referring to code like this where the configuration is read from stdin: https://github.com/belimawr/elastic-agent-inputs/blob/13c3e7da932148efa694d9c4608d3d6b4c45fcef/inputs/loadgenerator/core.go#L59-L70

func (l *loadGenerator) Start(ctx context.Context) error {
	agentClient, services, err := client.NewV2FromReader(os.Stdin, client.VersionInfo{
		Name:    "beat-v2-client",
		Version: "alpha",
		Meta:    map[string]string{},
	})
	if err != nil {
		return fmt.Errorf("error fetching client from stdin: %w", err)
	}
	l.logger.Debugf("Got client with configured services: %#v", services)
	return l.StartWithClient(ctx, agentClient)
}

There should be an option to read this from a configuration file for convenience.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

No branches or pull requests

3 participants