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

cmd/scollector: Track process PIDs. #1964

Merged
merged 2 commits into from
Nov 18, 2016
Merged
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
1 change: 1 addition & 0 deletions cmd/scollector/collectors/collectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const (
osProcCPUDesc = "The summed percentage of CPU time used by processes with this name (0-100)."
osProcMemRealDesc = "The total amount of real memory used by the processes with this name. For Linux this is RSS and in Windows it is the private working set."
osProcMemVirtualDesc = "The total amount of virtual memory used by the processes with this name."
osProcPID = "The PID of the process being tracked by a given ID tag. As this metric value represents the actual PID, it is not suitable for any form of aggregation."
osServiceRunningDesc = "1: active, 0: inactive"
osSystemUptimeDesc = "Seconds since last reboot."
)
Expand Down
3 changes: 2 additions & 1 deletion cmd/scollector/collectors/processes_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func linuxProcMonitor(w *WatchedProc, md *opentsdb.MultiDataPoint) error {
Add(md, "linux.proc.num_fds", len(fds), tags, metadata.Gauge, metadata.Files, descLinuxProcFd)
Add(md, "linux.proc.start_time", start_ts, tags, metadata.Gauge, metadata.Timestamp, descLinuxProcStartTS)
Add(md, "linux.proc.uptime", now()-start_ts, tags, metadata.Gauge, metadata.Second, descLinuxProcUptime)
Add(md, "linux.proc.pid", pid, tags, metadata.Gauge, metadata.Unit("PID"), osProcPID)
}
coreCount, err := linuxCoreCount()
if err != nil {
Expand Down Expand Up @@ -328,7 +329,7 @@ func (w *WatchedProc) Check(procs []*Process) {
w.Processes[*l] = w.get()
procFound[*l] = true
}
for proc, _ := range w.Processes {
for proc := range w.Processes {
if !procFound[proc] {
w.Remove(proc)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/scollector/collectors/processes_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func c_windows_processes() (opentsdb.MultiDataPoint, error) {
Add(&md, "win.proc.priority_base", v.PriorityBase, tags, metadata.Gauge, metadata.None, descWinProcPriority_base)
Add(&md, "win.proc.private_bytes", v.PrivateBytes, tags, metadata.Gauge, metadata.Bytes, descWinProcPrivate_bytes)
Add(&md, "win.proc.thread_count", v.ThreadCount, tags, metadata.Gauge, metadata.Count, descWinProcthread_count)
Add(&md, "win.proc.pid", v.IDProcess, tags, metadata.Gauge, metadata.Unit("PID"), osProcPID)
countByName[name]++
}
for name, count := range countByName {
Expand Down