Documentation ¶
Overview ¶
Package process collects metrics about the running processes using information from the operating system.
An example event looks as following:
{ "@timestamp": "2016-05-25T20:57:51.854Z", "beat": { "hostname": "host.example.com", "name": "host.example.com" }, "metricset": { "module": "system", "name": "process", "rtt": 12269 }, "system": { "process": { "cmdline": "/System/Library/CoreServices/ReportCrash", "cpu": { "start_time": "22:57", "total_p": 0 }, "mem": { "rss": 27123712, "rss_pct": 0.0016, "share": 0, "size": 2577522688 }, "name": "ReportCrash", "pid": 97801, "ppid": 1, "state": "running", "username": "elastic" } }, "type": "metricsets" }
Index ¶
- Variables
- func GetProcCpuPercentage(s0, s1 *Process) (normalizedPct, pct float64)
- func GetProcMemPercentage(proc *Process, totalPhyMem uint64) float64
- func New(base mb.BaseMetricSet) (mb.MetricSet, error)
- func Pids() ([]int, error)
- type Config
- type MetricSet
- type ProcStats
- type Process
- type ProcsMap
Constants ¶
This section is empty.
Variables ¶
var NumCPU = runtime.NumCPU()
Functions ¶
func GetProcCpuPercentage ¶
GetProcCpuPercentage returns the percentage of total CPU time consumed by the process during the period between the given samples. Two percentages are returned (these must be multiplied by 100). The first is a normalized based on the number of cores such that the value ranges on [0, 1]. The second is not normalized and the value ranges on [0, number_of_cores].
Implementation note: The total system CPU time (including idle) is not provided so this method will resort to using the difference in wall-clock time multiplied by the number of cores as the total amount of CPU time available between samples. This could result in incorrect percentages if the wall-clock is adjusted (prior to Go 1.9) or the machine is suspended.
func GetProcMemPercentage ¶
Types ¶
type Config ¶
type Config struct { Procs []string `config:"processes"` Cgroups *bool `config:"process.cgroups.enabled"` EnvWhitelist []string `config:"process.env.whitelist"` CacheCmdLine bool `config:"process.cmdline.cache.enabled"` IncludeTop includeTopConfig `config:"process.include_top_n"` IncludeCPUTicks bool `config:"process.include_cpu_ticks"` CPUTicks *bool `config:"cpu_ticks"` // Deprecated }
type MetricSet ¶
type MetricSet struct { mb.BaseMetricSet // contains filtered or unexported fields }
MetricSet that fetches process metrics.
type ProcStats ¶
type ProcStats struct { Procs []string ProcsMap ProcsMap CpuTicks bool EnvWhitelist []string CacheCmdLine bool IncludeTop includeTopConfig // contains filtered or unexported fields }
func (*ProcStats) GetProcStats ¶
func (*ProcStats) InitProcStats ¶
func (*ProcStats) MatchProcess ¶
type Process ¶
type Process struct { Pid int `json:"pid"` Ppid int `json:"ppid"` Pgid int `json:"pgid"` Name string `json:"name"` Username string `json:"username"` State string `json:"state"` CmdLine string `json:"cmdline"` Cwd string `json:"cwd"` Mem sigar.ProcMem Cpu sigar.ProcTime SampleTime time.Time FD sigar.ProcFDUsage Env common.MapStr // contains filtered or unexported fields }