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

using PR elastic/gosigar#13 to add process user_id to topbeat #773

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions topbeat/beat/sigar.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type Process struct {
Ppid int `json:"ppid"`
Name string `json:"name"`
State string `json:"state"`
Username string `json:"username"`
CmdLine string `json:"cmdline"`
Mem *ProcMemStat `json:"mem"`
Cpu *ProcCpuTime `json:"cpu"`
Expand Down Expand Up @@ -277,6 +278,7 @@ func GetProcess(pid int) (*Process, error) {
Ppid: state.Ppid,
Name: state.Name,
State: getProcState(byte(state.State)),
Username: state.Username,
CmdLine: cmdLine,
Mem: &ProcMemStat{
Size: mem.Size,
Expand Down
1 change: 1 addition & 0 deletions topbeat/beat/sigar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestGetProcess(t *testing.T) {
assert.True(t, (process.Pid > 0))
assert.True(t, (process.Ppid >= 0))
assert.True(t, (len(process.Name) > 0))
assert.True(t, (len(process.Username) > 0))
assert.NotEqual(t, "unknown", process.State)

// Memory Checks
Expand Down
1 change: 1 addition & 0 deletions topbeat/beat/topbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func (t *Topbeat) exportProcStats() error {
"ppid": process.Ppid,
"name": process.Name,
"state": process.State,
"username": process.Username,
"mem": process.Mem,
"cpu": process.Cpu,
}
Expand Down