-
Notifications
You must be signed in to change notification settings - Fork 2k
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
api: nomad debug
new /agent/host
#8325
Conversation
This change forwardMonitorClient and forwardProfileClient to use findClientConn, which was cribbed from the common parts of those funcs.
b564e61
to
67c17ae
Compare
67c17ae
to
41a06a6
Compare
81d430a
to
163b5da
Compare
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!
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.
Looks great overall! Redaction is a blocker, but otherwise we can ship anytime.
// mountedPaths produces a list of mounts | ||
func mountedPaths() []string { | ||
fh, err := os.Open("/proc/mounts") | ||
if err != nil { | ||
return []string{err.Error()} | ||
} | ||
rd := bufio.NewReader(fh) | ||
|
||
var paths []string | ||
for { | ||
str, err := rd.ReadString('\n') | ||
if err != nil { | ||
break | ||
} | ||
|
||
ln := strings.Split(str, " ") | ||
switch ln[2] { | ||
case "autofs", "binfmt_misc", "cgroup", "debugfs", | ||
"devpts", "devtmpfs", | ||
"fusectl", "fuse.lxcfs", | ||
"hugetlbfs", "mqueue", | ||
"proc", "pstore", "rpc_pipefs", "securityfs", | ||
"sysfs", "tmpfs", "vboxsf": | ||
continue | ||
default: | ||
} | ||
|
||
paths = append(paths, ln[1]) | ||
} | ||
|
||
return paths | ||
} |
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 think this is our 3rd implementation of mount point enumeration:
- Used in
/v1/client/stats
- https://github.com/hashicorp/nomad/blob/v0.12.0-beta2/client/stats/host.go#L183-L209 - Used in client node fingerprinting - https://github.com/hashicorp/nomad/blob/v0.12.0-beta2/client/fingerprint/storage_unix.go#L16
We don't have to fix this up for 0.12.0, but would you mind investigating if there's an opportunity to share code here and file an issue if so?
for _, c := range "ABCDEFGHIJKLMNOPQRSTUVWXYZ" { | ||
d := string(c) + ":\\" | ||
_, err := os.Stat(d) |
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.
Enumerating mount points on Windows is as simple as a b c 1 2 3 you and ... 🎶
facdd50
to
c4f59b8
Compare
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
/agent/host
is a new API endpoint that provides debug information about the agent's host environment from the perspective of the nomad process. #8306