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

Fix df parsing #28

Merged
merged 2 commits into from
Jan 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions inspector/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ func (i *DF) Parse(output string) {
log.Fatalf(`Error Parsing Percent Full: %s `, err)
}
// find size
for index := range columns {
_, err := strconv.ParseInt(columns[index], 0, 64)
originalColumns := columns
for index := range originalColumns {
_, err := strconv.ParseInt(originalColumns[index], 0, 64)
if err == nil {
columns[0] = strings.Join(columns[:index], " ")
columns[1] = columns[index]
columns[0] = strings.Join(originalColumns[:index], " ")
columns[1] = originalColumns[index]
columns[2] = originalColumns[index+1]
columns[3] = originalColumns[index+2]
break
}
}
Expand Down Expand Up @@ -138,7 +141,8 @@ type DFWin struct {
Values []DFMetrics
}

/* Parse : For the following windows output
/*
Parse : For the following windows output

Node,DeviceID,DriveType,FreeSpace,ProviderName,Size,VolumeName
IMANI,C:,3,191980253184,,288303964160,OS
Expand Down