diff --git a/load/load.go b/load/load.go index 86d9114..a4926c2 100644 --- a/load/load.go +++ b/load/load.go @@ -21,6 +21,7 @@ func (l AvgStat) String() string { type MiscStat struct { ProcsTotal int `json:"procsTotal"` + ProcsCreated int `json:"procsCreated"` ProcsRunning int `json:"procsRunning"` ProcsBlocked int `json:"procsBlocked"` Ctxt int `json:"ctxt"` diff --git a/load/load_linux.go b/load/load_linux.go index 081e2cc..38b4b03 100644 --- a/load/load_linux.go +++ b/load/load_linux.go @@ -92,6 +92,8 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) { continue } switch fields[0] { + case "processes": + ret.ProcsCreated = int(v) case "procs_running": ret.ProcsRunning = int(v) case "procs_blocked": diff --git a/load/load_test.go b/load/load_test.go index 0aa4de9..7b490a6 100644 --- a/load/load_test.go +++ b/load/load_test.go @@ -47,11 +47,12 @@ func TestMisc(t *testing.T) { func TestMiscStatString(t *testing.T) { v := MiscStat{ ProcsTotal: 4, + ProcsCreated: 5, ProcsRunning: 1, ProcsBlocked: 2, Ctxt: 3, } - e := `{"procsTotal":4,"procsRunning":1,"procsBlocked":2,"ctxt":3}` + e := `{"procsTotal":4,"procsCreated":5,"procsRunning":1,"procsBlocked":2,"ctxt":3}` if e != fmt.Sprintf("%v", v) { t.Errorf("TestMiscString string is invalid: %v", v) }