6c22cd587d
* command/agent/host: collect host data, multi platform * nomad/structs/structs: new HostDataRequest/Response * client/agent_endpoint: add RPC endpoint * command/agent/agent_endpoint: add Host * api/agent: add the Host endpoint * nomad/client_agent_endpoint: add Agent Host with forwarding * nomad/client_agent_endpoint: use findClientConn This changes forwardMonitorClient and forwardProfileClient to use findClientConn, which was cribbed from the common parts of those funcs. * command/debug: call agent hosts * command/agent/host: eliminate calling external programs
43 lines
690 B
Go
43 lines
690 B
Go
// +build linux
|
|
|
|
package host
|
|
|
|
import (
|
|
"bufio"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// 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
|
|
}
|