procstat collector¶
procstat
collects the host's processes' statistics.
Configuration¶
The common collector's configuration is:
Parameter | Type | Default | Description |
---|---|---|---|
id |
String | Collector's ID. Must be unique per agent instance. | |
type |
String | Must be procstat |
|
interval |
Integer | agent.defaults.interval |
Repetition interval in seconds |
labels |
Object | Additional collector-level labels | |
relabel |
Array | Optional relabeling rules. See Relabeling Rules for details |
The collector-specific configuration is:
Parameter | Type | Default | Description |
---|---|---|---|
expose_labels |
Array | List of value to enable optional labels. See Labels for details | |
self_pid |
Boolean | Include agent's own pid | |
pid_file |
String | Optional path to pid file | |
pattern |
String | Optional regular expression that matches the process' command line | |
cmd_separator |
String |
|
Separaror for cmd and __meta_cmd labels |
env_separator |
String | ; |
Separator for __meta_env label |
Config example:
Collected Metrics¶
Metric | Metric Type | Platform | Description |
---|---|---|---|
ps_num_fds |
Gauge | Linux | Number of open files |
ps_num_threads |
Gauge | Linux | Number of threads |
ps_voluntary_context_switches |
Counter | Linux | Total voluntary context switches |
ps_involuntary_context_switches |
Counter | Linux | Total involuntary context switches |
ps_minor_faults |
Counter | Linux | Total number of minor faults which do not requirie loading memory from disk |
ps_major_faults |
Counter | Linux | Total number of major faults which require loading memory from disk |
ps_child_minor_faults |
Counter | Linux | Total number of minor faults that process waited-for children made |
ps_child_major_faults |
Counter | Linux | Total number of major faults that process waited-for children made |
ps_cpu_time_user |
Counter | Linux | CPU time in user mode in seconds |
ps_cpu_time_system |
Counter | Linux | CPU time in system mode in seconds |
ps_cpu_time_iowait |
Counter | Linux | CPU time iowait in seconds |
ps_cpu_usage |
Gauge | Linux | Total CPU usage in percents |
ps_mem_total |
Counter | Linux | Total memory |
ps_mem_rss |
Counter | Linux | Resident set size |
ps_mem_swap |
Gauge | Linux | Swapped-out virtual memory size |
ps_mem_data |
Gauge | Linux | Data segment size |
ps_mem_stack |
Gauge | Linux | Stack segment size |
ps_mem_text |
Gauge | Linux | Text segment size |
ps_mem_lib |
Gauge | Linux | Shared library code size |
ps_mem_locked |
Gauge | Linux | Locked memory size |
ps_read_count |
Counter | Linux | Total read I/O operations |
ps_write_count |
Counter | Linux | Total write I/O operations |
ps_read_bytes |
Counter | Linux | Total bytes read |
ps_write_bytes |
Counter | Linux | Total bytes written |
Labels¶
procstat
collector appends the following labels:
Label | expose_labels |
Description |
---|---|---|
process_name |
Name of the process | |
user |
user |
Process' effective user name |
cmd |
cmd |
Full command line separated by cmd_separator |
__meta_cmd |
__meta_cmd |
Virtual label version of cmd |
__meta_env |
__meta_env |
Virtual label containing the process' environmenr separated by env_separator |
expose_labels
may take the following values:
user
- Exposeuser
label.cmd
- Exposecmd
label.__meta_cmd
- Expose__meta_cmd
label.__meta_env
- Expose__meta_env
label.
Config Discovery¶
procstat
collector supports the Config Discovery by default.
To disable a particular block use the --config-discovery-opts
option:
Process Name Rewritting¶
Sometimes, the process name is non-unique and misleading. Then the Relabeling Rules
come to the resque. Consider we have a set of the services launched by run
command using syntax
Then we can configure procstat
collector to fetch proper name to the labels:
- id: Procstat
type: procstat
...
expose_labels: [__meta_cmd]
relabel:
- source_labels: [__meta_cmd]
regex: "run (.+)"
replacement: "$1"
target_label: process_name
action: replace
Then the process_name
label will contain service name, instead of run
.