Skip to content

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

@blakerouse

Description

@blakerouse

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions