-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add RHEL/Centos support to the system/users metricset #16902
Add RHEL/Centos support to the system/users metricset #16902
Conversation
Pinging @elastic/integrations-services (Team:Services) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks! It will need some changelog entries, for the fix and for the new option.
Do you think it would be possible to add some integration tests? I would be ok with leaving this for a future change as it can be tricky for systemd, I will add the test-plan
label by now.
|
||
//call "introspect" on the systemd1 path to see what ListUnit* methods are available | ||
obj := conn.Object("org.freedesktop.systemd1", dbusRaw.ObjectPath("/org/freedesktop/systemd1")) | ||
err = obj.Call("org.freedesktop.DBus.Introspectable.Introspect", 0).Store(&props) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting!
@jsoriano Testing this isn't particularly easy--we don't have any OS level integration tests, so I'm relying on testing parsers. |
Co-Authored-By: Jaime Soriano Pastor <jaime.soriano@elastic.co>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intake is failing in CI, for the rest it LGTM.
@@ -112,6 +112,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d | |||
- Fix detection and logging of some error cases with light modules. {pull}14706[14706] | |||
- Fix imports after PR was merged before rebase. {pull}16756[16756] | |||
- Add dashboard for `redisenterprise` module. {pull}16752[16752] | |||
- Dynamically choose a method for the system/service metricset to support older linux distros. {pull}16902[16902] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a moment I thought that it should say system/users
metricset, but is the title of the issue what is wrong. Remember this when forging the commit message! 🙂
…eats into services-rhel-support
* 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)
* 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)
Fix extracted from: elastic/beats#16902
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