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

Make windows drive range configurable #450

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

thll
Copy link
Contributor

@thll thll commented Oct 7, 2022

Adds a new configuration option to control which windows drives are included for available disk space scanning:

windows_drive_range: "CDEFGHIJKLMNOPQRSTUVWXYZ"

To only scan disks C: and D:, set this to:

windows_drive_range: "CD"

To not scan any drives at all, set this to:

windows_drive_range: ""

Fixes #371

@thll thll marked this pull request as ready for review October 19, 2022 14:59
@thll thll requested a review from mpfz0r October 19, 2022 14:59
@mpfz0r mpfz0r self-assigned this Oct 25, 2022
func getWindowsDrives() (drives []sigar.FileSystem) {
for _, drive := range "CDEFGHIJKLMNOPQRSTUVWXYZ" {
func getWindowsDrives(windowsDriveRange string) (drives []sigar.FileSystem) {
for _, drive := range windowsDriveRange {
dirName := string(drive) + ":\\"
dirHandle, err := os.Open(dirName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why we even have to open the drive to get the metrics 🤷

@mpfz0r mpfz0r merged commit 457e40d into master Oct 25, 2022
@mpfz0r mpfz0r deleted the configurable-windows-drive-range branch October 25, 2022 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the list of scanned hard drives configurable (Windows/Sigar)
2 participants