Skip to content

[beats receivers] Monitoring receiver status persists after an unenroll action when they are not actually running #10634

@cmacknz

Description

@cmacknz

The reproduction is what the testInstallAndUnenrollWithEndpointSecurity does in the failing tests in the PR above:

  1. Enroll agent in a policy with defend that uses beats receivers
  2. Unenroll the agent via the Fleet UI
  3. Wait for Defend to be removed
  4. Observe the state of the beats receivers for monitoring continue to be reported
  5. Also observe the collector sub-process is not running. This seems to be a bug where we are not clearing the state on unenroll. Unenroll through fleet sends agent and empty agent policy to execute to remove all inputs. We seem to stop the collector but not clear its status.
ubuntu@ubuntu24:~/elastic-agent-9.3.0-SNAPSHOT-linux-arm64$ systemctl status elastic-agent
● elastic-agent.service - Elastic Agent is a unified agent to observe, monitor and protect your system.
     Loaded: loaded (/etc/systemd/system/elastic-agent.service; enabled; preset: enabled)
     Active: active (running) since Wed 2025-10-15 16:15:04 EDT; 5min ago
   Main PID: 7497 (elastic-agent)
      Tasks: 12 (limit: 1059)
     Memory: 135.7M (peak: 637.1M)
        CPU: 5.586s
     CGroup: /system.slice/elastic-agent.service
             └─7497 elastic-agent

ubuntu@ubuntu24:~/elastic-agent-9.3.0-SNAPSHOT-linux-arm64$ sudo elastic-agent status --output=full
┌─ fleet
│  └─ status: (HEALTHY) Connected
└─ elastic-agent
   ├─ status: (HEALTHY) Running
   ├─ info
   │  ├─ id: 5bcd2335-398b-4a39-aa67-9185ccb0538f
   │  ├─ version: 9.3.0
   │  └─ commit: c26dee602037f4808433a7a40d9fcb7097555267
   ├─ beat/metrics-monitoring
   │  ├─ status: (HEALTHY) HEALTHY
   │  ├─ beat/metrics-monitoring
   │  │  ├─ status: (HEALTHY) Healthy
   │  │  └─ type: OUTPUT
   │  └─ beat/metrics-monitoring-metrics-monitoring-beats
   │     ├─ status: (HEALTHY) Healthy
   │     └─ type: INPUT
   ├─ filestream-monitoring
   │  ├─ status: (HEALTHY) HEALTHY
   │  ├─ filestream-monitoring
   │  │  ├─ status: (HEALTHY) Healthy
   │  │  └─ type: OUTPUT
   │  └─ filestream-monitoring-filestream-monitoring-agent
   │     ├─ status: (HEALTHY) Healthy
   │     └─ type: INPUT
   ├─ http/metrics-monitoring
   │  ├─ status: (HEALTHY) HEALTHY
   │  ├─ http/metrics-monitoring
   │  │  ├─ status: (HEALTHY) Healthy
   │  │  └─ type: OUTPUT
   │  └─ http/metrics-monitoring-metrics-monitoring-agent
   │     ├─ status: (HEALTHY) Healthy
   │     └─ type: INPUT
   └─ prometheus/metrics-monitoring
      ├─ status: (HEALTHY) HEALTHY
      ├─ prometheus/metrics-monitoring
      │  ├─ status: (HEALTHY) Healthy
      │  └─ type: OUTPUT
      └─ prometheus/metrics-monitoring-metrics-monitoring-collector
         ├─ status: (HEALTHY) Healthy
         └─ type: INPUT

Debug logs from when this happens are attached.

elastic-agent.log

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions