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 2 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
4 changes: 3 additions & 1 deletion topbeat/beat/sigar.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

"github.com/elastic/gosigar"
"github.com/eonarheim/gosigar"
)

type SystemLoad struct {
Expand Down Expand Up @@ -64,6 +64,7 @@ type Process struct {
Ppid int `json:"ppid"`
Name string `json:"name"`
State string `json:"state"`
UserId string `json:"user_id"`
CmdLine string `json:"cmdline"`
Mem *ProcMemStat `json:"mem"`
Cpu *ProcCpuTime `json:"cpu"`
Expand Down Expand Up @@ -276,6 +277,7 @@ func GetProcess(pid int) (*Process, error) {
Pid: pid,
Ppid: state.Ppid,
Name: state.Name,
UserId: state.UserId,
State: getProcState(byte(state.State)),
CmdLine: cmdLine,
Mem: &ProcMemStat{
Expand Down
15 changes: 8 additions & 7 deletions topbeat/beat/topbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"time"

"github.com/elastic/gosigar"
"github.com/eonarheim/gosigar"

"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/cfgfile"
Expand Down Expand Up @@ -208,12 +208,13 @@ func (t *Topbeat) exportProcStats() error {
newProcs[process.Pid] = process

proc := common.MapStr{
"pid": process.Pid,
"ppid": process.Ppid,
"name": process.Name,
"state": process.State,
"mem": process.Mem,
"cpu": process.Cpu,
"pid": process.Pid,
"ppid": process.Ppid,
"name": process.Name,
"state": process.State,
"user_id": process.UserId,
"mem": process.Mem,
"cpu": process.Cpu,
}

if process.CmdLine != "" {
Expand Down
2 changes: 1 addition & 1 deletion topbeat/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
topbeat "github.com/elastic/beats/topbeat/beat"
topbeat "github.com/dr-toboggan/beats/topbeat/beat"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not a good idea as it would mean our topbeat is built based on your repo :-) Please change it back to elastic.


"github.com/elastic/beats/libbeat/beat"
)
Expand Down