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

metricbeat/system: check requirements for metricsets in the constructor #41963

Open
mauri870 opened this issue Dec 9, 2024 · 4 comments
Open
Labels
enhancement Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@mauri870
Copy link
Member

mauri870 commented Dec 9, 2024

Some system metricsets require kernel modules to be loaded or other prerequisites to be met in order to function properly. We should make a best effort to always check these requirements in the metricset's New method.

An example of such a scenario can be found in elastic/elastic-agent#6155. In this case, the absence of the nf_conntrack module caused errors during metric collection. Similarly, RAID metrics fail during fetching if the system was not configured for RAID. These issues could have been avoided by checking these conditions during the metricset creation process.

Additionally, this approach helps inform the user of necessary actions by displaying an error when data collection from a specific source is requested but cannot proceed without modifications to the host system. Communicating these requirements to the user is a key purpose of this feature.

For the raid and conntrack metricsets, in the New method:

  • raid: Check that the system has a RAID configuration
  • conntrack: check that the nf_conntrack module is loaded (probably just checking if /proc/net/stat/nf_conntrack exists is enough)

We should also check the remaining system metricsets if they fall into this category. I'd say at least the metricsets that require a kernel module (under system/linux) to be loaded should check for it in the constructor.

@mauri870 mauri870 added enhancement Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Dec 9, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@BenB196
Copy link

BenB196 commented Dec 9, 2024

I had opened some issues a while back under the integrations project, I only found one additional issue, elastic/integrations#4880, but it's been a bit since I checked, not sure if new ones were introduced.

elastic/integrations#4879
elastic/integrations#4881

@mauri870
Copy link
Member Author

I had opened some issues a while back under the integrations project, I only found one additional issue, elastic/integrations#4880, but it's been a bit since I checked, not sure if new ones were introduced.

Thanks for linking to these issues. It’s likely the same problem I’m describing here. It seems the issue is even broader than I initially thought. Looks like most modules in system/linux require kernel modules to operate.

@VihasMakwana
Copy link
Contributor

+1 for this.

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

No branches or pull requests

4 participants