Cherry-pick #16902 to 7.x: Add RHEL/Centos support to the system/users metricset #16984
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 viaListUnitsByPatterns
. This also exposespattern_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
Author's Checklist
How to test this PR locally
pattern_filter
orstate_filter
values.Related issues
Closes #16757 and #16753