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

Cherry-pick #16902 to 7.x: Add RHEL/Centos support to the system/users metricset #16984

Merged
merged 1 commit into from
Mar 16, 2020

Conversation

fearful-symmetry
Copy link
Contributor

@fearful-symmetry fearful-symmetry commented Mar 12, 2020

Cherry-pick of PR #16902 to 7.x branch. Original message:

What does this PR do?

This PR is a simultaneous bugfix/enhancement that addresses both #16757 and #16753. Rather than use the dbus ListUnitsByPatterns method, we make an introspection call to dbus, look at the methods available to us, and then return a function pointer to make a call dependent on what is available. The goal is to make systemd do as much of the work is possible, only falling back to filtering methods within metricbeat as needed. The filtering behavior implemented here is designed to emulate what happens on the dbus end via ListUnitsByPatterns. This also exposes pattern_filter since it was a 2-line change, and should be useful.

Why is it important?

Currently, this metricset doesn't work on Centos7/RHEL7, due to the ListUnitsByPatterns method being too new.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • Additonal testing needs to be done on centos and RHEL.

How to test this PR locally

  • Pull down and build the branch on centos 7.
  • Run this metricset. Optionally, add some pattern_filter or state_filter values.

Related issues

Closes #16757 and #16753

* major refactor to support different systemd version

* format and updates

* update ref docs

* update ref, again

* add newline

* Fix error string

Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>

* add changelog entry

* make update

* add build target

Co-authored-by: Jaime Soriano Pastor <jaime.soriano@elastic.co>
(cherry picked from commit 1d36da7)
Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks for commenting functions too, it helps to understand the code

@fearful-symmetry fearful-symmetry merged commit f1525da into elastic:7.x Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants