-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement df handler #5
Conversation
func DfLinuxHandler(w http.ResponseWriter, r *http.Request) { | ||
response, err := df.Df() | ||
if err != nil { | ||
http.Error(w, "Failed to retrieve disk info: "+err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
json.NewEncoder(w).Encode(response) | ||
} |
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.
Could you also add this part to other handlers and commands? It seems that the error handling is not implemented for other handlers as well.
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'm guessing you are talking about UptimeLinuxHandler.
IMO I think this PR should only contain the changes of df
command.
So creating a new issue for this could be the good idea.
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.
k
fields := strings.Fields(line) | ||
if fields[0] == "map" { | ||
// Filesystem is "map auto_home" | ||
fields[1] = "map " + fields[1] | ||
fields = fields[1:] | ||
} |
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.
It seems too sporadic... There should typically be single spaces in filesystem names, so could we identify information from other categories by noticing that the spacing between characters is more than two?
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.
In the example below, you can see that the number of spaces between data of Used
and Available
is 1.
It means that there should be the case when there is a single space between Filesystem
and 512-blocks
.
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 478724992 20844296 225635920 9% 407401 1128179600 0% /
devfs 711 711 0 100% 1230 0 100% /dev
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.
Okay, I'll let it go as an occasional case.
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.
lgtm
Type of PR
Implemented
/linux/df
endpoint.Description
Same as above. Closes #2