-
Notifications
You must be signed in to change notification settings - Fork 93
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 support for device types and predictable device paths #235
base: master
Are you sure you want to change the base?
Add support for device types and predictable device paths #235
Conversation
We will now log a warning if smartctl path passed via command line is invalid. Signed-off-by: Piotr Dobrowolski <[email protected]>
This adds a new command line option allowing for customization of autodetected device types and enables use of special "by-id" device type that forces use of predictable device paths (/dev/disk/by-id/...) Relevant change to device name parsing regular expression is included now, so predictable device paths are now also usable when directly specified. Signed-off-by: Piotr Dobrowolski <[email protected]>
8331cff
to
76cae35
Compare
76cae35
to
95b255e
Compare
Signed-off-by: Piotr Dobrowolski <[email protected]>
95b255e
to
319184c
Compare
Anyone here? I think this feature very useful and I need it, I wonder what other issues need to be reviewed before we can merge and release? |
I have attempted to use the
But no devices have been found. But if I specify a device explicitly it does work:
Which does work:
But it means each device has to be specified manually. Which is still better than what we had before, so good improvement. I know I can identify all the devices using
So it can be automated with Ansible. |
If I use
Which is progress, but not sure if it can work with just a scan. Though a separate PR could possibly extend the functionality with parsing of outpuit from |
Forgot to add that I really appreciate your work on this. Issues with lack of metrics for |
@jakubgs you should provide the output from |
Sure thing, here you go:
|
Don't know exactly, but looks very strange. By default smartctl scan should report about all devices, and
But your output return |
I don't think I can easily install
|
Regardless of |
You always can build packages for yourself, or run another distro for debugging purposes
And seems there are the place https://github.com/smartmontools/smartmontools/blob/master/smartmontools/os_linux.cpp#L3137 - this is why we seen |
I was tested this patch over the master. For me - works as expected 🤝
Only one breaking change that I found, is, for who's don't need
I think should be merged, and then we can take a look to #204 and release 0.13 📦 |
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.
I agree, I think this PR solves a lot of long standing issues. My special case is not covered by smartctl
so it can be ignored.
@Informatic can you include some before & after examples of the device labels? I'm worried users may depend on specific values there, and I wouldn't want it to change and surprise them. |
The label
By default the |
@k0ste Sorry I've been away for a while. Sometimes life happens. I was going to move the last merge request that broke things behind an "experimental" flag for people to test. I don't think it's realistic to test a pull request against all configurations. This way the experimental changes can be tested in the field without affecting the stable code. I'll look at this in the next few days. More than likely, I'll put this behind an |
Ah, right. Just noticed this is another thing that (I think?) got changed
in the aforementioned patch (filter matching against device label, not
device path). This should be easily fixable in main.go (
https://github.com/Informatic/smartctl_exporter/blob/319184ce66d88b706d4ce4939b68e0c68a712b0e/main.go#L143)
- though in the end that could still cause a minor incompatibility (because
we need to *somehow* pass device type for filtering there - right now
device label is unique and contains device type in certain cases)
…On Fri, 23 Aug 2024, 15:11 Konstantin Shalygin, ***@***.***> wrote:
@NiceGuyIT <https://github.com/NiceGuyIT> @robbat2
<https://github.com/robbat2> @SuperQ <https://github.com/SuperQ>
I was tested this patch over the master. For me - works as expected 🤝
- works with HBA (SATA HDD)
- works with megaraid in HBA mode (SATA HDD)
Only one breaking change that I found, is, for who's don't need megaraid
at all:
smartctl.device-exclude="^/dev/bus/[0-9]+$"
must be changed to:
smartctl.device-exclude="(.*)bus(.*)" (or "(.*)megaraid(.*)")
I think should be merged, and then we can take a look to #204
<#204> and
release 0.13 📦
—
Reply to this email directly, view it on GitHub
<#235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIUEXUUBBVFOVBXVS33WW3ZS4YJFAVCNFSM6AAAAABK3L63WGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGA3DMNZXGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
We still have a chance to make second release in this year 🥈 |
Or you could just make a Release Candidate and have people try it out. But yeah, it is a significant change. |
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.
This needs a rebase after the change to the new logging library.
@Informatic 🙏🏼 |
This is a couple of tightly related changes:
--smartctl.scan-device-type
command line option allowing for customization of autodetected device types and enables use of specialby-id
device type that forces use of predictable device paths (/dev/disk/by-id/...
)device
label generation - this is now based offdevice.name
anddevice.type
instead of relying ondevice.info_name
- this changes label since Added determining device type and use it at scrape data #205, but stays compatible with latest stable release, and is probably the best way forward (though I am open for suggestions - I was thinking of adding an extra option to still output device path and type as separate labels)--smartctl.device
call via semicolon separator--smartctl.device=/dev/bus/0;megaraid,0
will result in:smartctl -d megaraid,0 /dev/bus/0
and outputdevice="bus_0_megaraid_0"
metric label)--smartctl.device
will disable autodiscovery.--smartctl.scan
, for whatever reason.auto
type on autodetectedscsi
drives.Fixes #134, #230, #89, probably #229 too...