fix(smartctl_exporter): add kernel capabilities#711
Open
volker-raschek wants to merge 1 commit intoprometheus-community:mainfrom
Open
fix(smartctl_exporter): add kernel capabilities#711volker-raschek wants to merge 1 commit intoprometheus-community:mainfrom
volker-raschek wants to merge 1 commit intoprometheus-community:mainfrom
Conversation
ff470ba to
2ff4b78
Compare
The following patch adds the capabilities that the binary needs to access the disks without root privileges. The capabilities were determined using the following command. The process ID `1259363` is that of `smartctl_exporter` when it was previously executed as root. ```bash $ capsh --decode=$(grep CapBnd /proc/1259363/status | cut -f 2) 0x0000000000020004=cap_dac_read_search,cap_sys_rawio ``` The capabilities `CAP_DAC_READ_SEARCH` and `CAP_SYS_RAWIO` were added to the systemd unit, taking into account the systemd version. With this patch can be smartctl_exporter successfully started. Signed-off-by: Markus Pesch <markus.pesch@cryptic.systems>
2ff4b78 to
d8ad9a2
Compare
SuperQ
approved these changes
Mar 6, 2026
Member
|
Could the capabilities be set on the binary itself like we do with the For reference: #729 Edit: I just remembered that I actually was working on a similar implementation here: https://github.com/prometheus-community/ansible/pull/629/changes#diff-94cc2fd2f52225dbe9db6ef1b16a27190ebc7a485c246bf013c1d0d6e9d86ebbR38 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The following patch adds the capabilities that the binary needs to access the disks without root privileges.
The capabilities were determined using the following command. The process ID
1259363is that ofsmartctl_exporterwhen it was previously executed as root.$ capsh --decode=$(grep CapBnd /proc/1259363/status | cut -f 2) 0x0000000000020004=cap_dac_read_search,cap_sys_rawioThe capabilities
CAP_DAC_READ_SEARCHandCAP_SYS_RAWIOwere added to the systemd unit, taking into account the systemd version.With this patch can be smartctl_exporter successfully started.
A similar patch for the prometheus-smartctl-exporter has already been accepted for the Arch Linux package.
https://gitlab.archlinux.org/archlinux/packaging/packages/prometheus-smartctl-exporter/-/commit/b872776265474e9bd8b69ff128c002cf4b005f44