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

[Elastic Agent] Add ability to communicate and control the running agent daemon. #20142

Closed
blakerouse opened this issue Jul 22, 2020 · 9 comments · Fixed by #21425
Closed

[Elastic Agent] Add ability to communicate and control the running agent daemon. #20142

blakerouse opened this issue Jul 22, 2020 · 9 comments · Fixed by #21425
Assignees

Comments

@blakerouse
Copy link
Contributor

blakerouse commented Jul 22, 2020

To provide a rich UX for the Elastic Agent we need to provide a way to communicate and control the running Elastic Agent.

Information that needs to be able to be retrieved from the local agent:

  • Running version (possible different then the executing binary, but rare)
  • Current status
    • Overall agent status
    • Status of each application
  • Ability to restart Elastic Agent (self-restarts self with re-exec)
  • Ability to trigger self-upgrade Elastic Agent

Below documents the commands and expected outputs:

version

Same version

$ elastic-agent version
Running Daemon: 7.9.0-SNAPSHOT (build: unknown at 0001-01-01 00:00:00 +0000 UTC)
Executable: 7.9.0-SNAPSHOT (build: unknown at 0001-01-01 00:00:00 +0000 UTC)

Not running

$ elastic-agent version
Running Daemon: <not running>
Executable: 7.9.0-SNAPSHOT (build: unknown at 0001-01-01 00:00:00 +0000 UTC)

Different versions running

$ elastic-agent version
WARN: The running version of Elastic Agent does not match this version.
Running Daemon: 7.9.0-SNAPSHOT (build: unknown at 0001-01-01 00:00:00 +0000 UTC)
Executable: 8.0.0-SNAPSHOT (build: unknown at 0001-01-01 00:00:00 +0000 UTC)

status

$ elastic-agent status
Status: Degraded
Message: 1 application is degraded

Application           Status             Message
Filebeat              Healthy            Running
Metricbeat            Degraded           system/load is an invalid metricset
Endpoint Security     Healthy            Protected with policy {000-....}        

restart

The different [/] below are showing interactive progress of what the command will report as its performing the restart action. It will then just print Successfully restarted over the progress.

$ elastic-agent restart
[/] Triggering restart
[-] Waiting to reconnect
[\] Reconnecting
[|] Connected
Successfully restarted

upgrade

The different [/] below are showing interactive progress of what the command will report as its performing the restart action. It will then just print Successfully restarted over the progress.

Next-version in same major

$ elastic-agent upgrade
[/] Triggering upgrade
[-] Upgrading to 7.9.1
[\] Reconnecting
[|] Connected
Successfully upgraded to 7.9.1

Next major

$ elastic-agent upgrade --version 8.0.0
[/] Triggering upgrade
[-] Upgrading to 8.0.0
[\] Reconnecting
[|] Connected
Successfully upgraded to 8.0.0

Specific version

$ elastic-agent upgrade --version 7.9.2-SNAPSHOT
[/] Triggering upgrade
[-] Upgrading to 8.9.2-SNAPSHOT
[\] Reconnecting
[|] Connected
Successfully upgraded to 7.9.2-SNAPSHOT
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 22, 2020
@blakerouse blakerouse changed the title [Elastic Agent [Elastic Agent] Add ability to communicate and control the running agent daemon. Jul 22, 2020
@blakerouse blakerouse self-assigned this Jul 22, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 22, 2020
@blakerouse
Copy link
Contributor Author

@ph @ruflin @michalpristas Implementing this will greatly help with UX, re-exec testing, and upgrade testing. Let me know what you think.

@blakerouse
Copy link
Contributor Author

Another improvement this brings is also the installation process. Currently we install Agent without starting the service and the configuration is basic and trying to write system metrics to localhost:4200.

I believe with the above changes we should do the following:

  • Change the installation to use an empty elastic-agent.yml configuration, with nothing configured.
  • Change the installation to start elastic-agent run on install and startup (but its doing nothing, because of empty config).
  • Change the ending result of successful enroll to internally call elastic-agent restart, which will cause the daemon to re-exec switch into the fleet mode and start working. (removing the need for the user to worry about enabling and starting services)

@ph
Copy link
Contributor

ph commented Jul 22, 2020

@blakerouse I really like this plan, the description is top!

I like the proposal for the empty configuration and the reload, we had an issue to allow have a enroll and run from a same subcommand. But I think what you are suggesting for service is even better than that and will simplify the workflow.

@EricDavisX The above will impact testings for the best, you might have suggestion too?

@EricDavisX
Copy link
Contributor

sounds good to me.

@ph
Copy link
Contributor

ph commented Aug 25, 2020

@blakerouse Can this be closed?

@blakerouse
Copy link
Contributor Author

@ph I was leaving it open until upgrade was implemented.

@EricDavisX
Copy link
Contributor

how much, if any, coordination do we need to do now to ensure design is compatible with Endpoint, @blakerouse ? @ferullo fyi.

  • I'm guessing it all 'just works' right? Just trying to envision at what point the new Endpoint binary is downloaded and started, is it after the new Agent version is re-started or (before) as part of the setup before restart?

@blakerouse
Copy link
Contributor Author

@EricDavisX Endpoint should just work, once Agent is upgraded it will then upgrade Endpoint to match the same version of Agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants