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

diskdrive collector (windows_diskdrive_availability) #1607

Open
Sixty502 opened this issue Sep 5, 2024 · 5 comments
Open

diskdrive collector (windows_diskdrive_availability) #1607

Sixty502 opened this issue Sep 5, 2024 · 5 comments

Comments

@Sixty502
Copy link

Sixty502 commented Sep 5, 2024

Problem Statement

In looking at the diskdrive collector, I tried to see if I could use windows_diskdrive_availability to find problems. On the machines I've looked at, the values are aways zero. When I look at win32_diskdrive for any of my disks, Availability, which appears to be where the information comes from, is always NULL.

MSFT_Disk (Get-WmiObject -Class MSFT_Disk -Namespace root\Microsoft\Windows\Storage |select *) seems to provide more information. OfflineReason and OperationalStatus have values that indicate the status of the drive(s).

I'm not sure if there is an issue with the information in windows_diskdrive_availability or if I need a better way to test and make the values change.

Environment

  • windows_exporter Version: 0.28.0
  • Windows Server Version: WS19,WS22
@DiniFarb
Copy link
Contributor

DiniFarb commented Sep 5, 2024

Yes I can confirm that Availability isn't always provided. The windows_exporter uses this call to gather the info:

SELECT DeviceID, Model, Caption, Name, Partitions, Size, Status, Availability FROM WIN32_DiskDrive

It seems that Availability is not always there. It depends maybe on disk kind or win version. I tested this with:

Get-WmiObject -Query "SELECT Availability FROM WIN32_DiskDrive"

on some machines and it returned always nothing.

In the exporter, if nothing is returned, the variable disk.Availability is 0 and it can never set the isCurrentState to 1 since availMap starts with 1 and has no 0 entry

for availNum, val := range availMap {
isCurrentState := 0.0
if availNum == int(disk.Availability) {
isCurrentState = 1.0
}
ch <- prometheus.MustNewConstMetric(
c.availability,
prometheus.GaugeValue,
isCurrentState,
strings.Trim(disk.Name, "\\.\\"), //nolint:staticcheck
val,
)
}

EDIT:

If someone can maybe confirm that on some machines Availability is returned, cos it is actually in the ms docs: https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-diskdrive#properties

  • If yes I'd say that availMap should have a state 0 with a value set maybe "not implemented" or something.
  • If no or it is very rare that a value is returned I'd say that Availability should be removed from the exporter.

@Sixty502
Copy link
Author

I looked at a few more machines and didn't find one with Availability populated. It seems like it should default to 6 (Not Applicable) and not NULL.

@jkroepke
Copy link
Member

I feel that current behavior is fine. If windows report no value, the exporter should not fake a value.

@Sixty502
Copy link
Author

I was thinking about what Windows is reporting. I wouldn't want exporter or Windows making something up. Whatever should be providing the information isn't. Null is one way for them to handle it, but it seems like Unknown (2) or Not Applicable (6) would indicate the lack of information. Maybe they will fix it in WS2025. :)

For Exporter, the only suggestion would be a note in collector.diskdrive.md about the information Windows returns can be null.

@jkroepke
Copy link
Member

Thermalzone has similiar issues. Win32_Sensor ist most of the time empty, too.

Feels like Microsoft create some generic solutions, but no hardware vendor implement them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants