Add process information to the UI.
For root, we report all processes. Process stats are refreshed every minute.
This commit is contained in:
parent
d61a381e84
commit
2a99748874
@ -117,14 +117,18 @@ func (c *containerData) DerivedStats() (v2.DerivedStats, error) {
|
||||
}
|
||||
|
||||
func (c *containerData) GetProcessList() ([]v2.ProcessInfo, error) {
|
||||
// report all processes for root.
|
||||
isRoot := c.info.Name == "/"
|
||||
pidMap := map[int]bool{}
|
||||
if !isRoot {
|
||||
pids, err := c.handler.ListProcesses(container.ListSelf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pidMap := map[int]bool{}
|
||||
for _, pid := range pids {
|
||||
pidMap[pid] = true
|
||||
}
|
||||
}
|
||||
// TODO(rjnagal): Take format as an option?
|
||||
format := "user,pid,ppid,stime,pcpu,rss,vsz,stat,time,comm"
|
||||
args := []string{"-e", "-o", format}
|
||||
@ -151,7 +155,7 @@ func (c *containerData) GetProcessList() ([]v2.ProcessInfo, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid ppid %q: %v", fields[2], err)
|
||||
}
|
||||
if pidMap[pid] == true {
|
||||
if isRoot || pidMap[pid] == true {
|
||||
processes = append(processes, v2.ProcessInfo{
|
||||
User: fields[0],
|
||||
Pid: pid,
|
||||
|
@ -108,6 +108,12 @@ const containersHtmlTemplate = `
|
||||
</div>
|
||||
<div id="usage-gauge" class="panel-body"></div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Processes</h3>
|
||||
</div>
|
||||
<div id="processes-top" class="panel-body"></div>
|
||||
</div>
|
||||
{{if .CpuAvailable}}
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
|
File diff suppressed because it is too large
Load Diff
1395
pages/static/gcharts_js.go
Normal file
1395
pages/static/gcharts_js.go
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user