Skip to content

Diagnostics fails for monitoring beats #1022

@michalpristas

Description

@michalpristas

Sometimes when running diagnostics we can get result like this one

elastic-agent  id: 8164ce38-08ea-422e-9b97-333a96f9f957                version: 8.4.1
               build_commit: 88efae57aad9e90729bc40a43433fb6b84dab8d8  build_time: 2022-08-26 11:17:17 +0000 UTC  snapshot_build: true
Applications:
  *  name: filebeat_monitoring  route_key: default
     error: Get "http://unix/": dial unix /Library/Elastic/Agent/data/tmp/default/filebeat/filebeat.sock: connect: no such file or directory
  *  name: filebeat                       route_key: default
     process: filebeat                    id: c7e9303d-2502-4f29-8937-7e753508c90b          ephemeral_id: 2e886099-a3f6-44b0-9554-f7ae413c79d2  elastic_license: true
     version: 8.4.1                       commit: fe210d46ebc339459e363ac313b07d4a9ba78fc7  build_time: 2022-08-26 11:09:14 +0000 UTC           binary_arch: amd64
     hostname: Michals-MacBook-Pro.local  username: root                                    user_id: 0                                          user_gid: 0

Important part is this error: Get "http://unix/": dial unix /Library/Elastic/Agent/data/tmp/default/filebeat/filebeat.sock: connect: no such file or directory

This happens when user tries to fetch stats from monitoring filebeat and regular filebeat has no actionable config or
monitoring metricbeat when regular metricbeat has no actionable config.

There are 2 reasons for that.

First reason is that diagnostics command is trying to reach http.host of regular beat instead of monitoring one. Monitoring beats should have _monitor suffix resulting in a name filebeat.sock_monitor

Second reason is that monitoring beats don't expose these endpoints at all.
Reason for it is here:

monitor = noop.NewMonitor()

We use NoopMonitoring for monitoring beats which has no-action EnrichArgs this enrich args function produces all arguments passed to beats needed to end up with exposing all the things needed. But as we initially were working under assumption that monitoring beats should not monitor themselves we saved resources and used noop monitor instead of regular one.

In order to expose proper metrics endpoint this needs to be replaced by beats monitor.

To fix this we need to append _monitor before endpoint is used in server.go and change monitor type used as described above

cc @michel-laterman @AndersonQ

Metadata

Metadata

Assignees

No one assigned

    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