Skip to content

Process


The process collector can monitor various running processes in the system, acquire and analyze various metrics when the process is running, Including memory utilization rate, CPU time occupied, current state of the process, port of process monitoring, etc. According to various index information of process running, users can configure relevant alarms in Guance, so that users can know the state of the process, and maintain the failed process in time when the process fails.

Warning

Process collectors (whether objects or metrics) may consume a lot on macOS, causing CPU to soar, so you can turn them off manually. At present, the default collector still turns on the process object collector (it runs once every 5min by default).

Configuration

Preconditions

  • The process collector does not collect process metrics by default. To collect metrics-related data, set open_metric to true in host_processes.conf. For example:
[[inputs.host_processes]]
    ...
     open_metric = true

Collector Configuration

Go to the conf.d/samples directory under the DataKit installation directory, copy host_processes.conf.sample and name it host_processes.conf. Examples are as follows:

[[inputs.host_processes]]
  # Only collect these matched process' metrics. For process objects
  # these white list not applied. Process name support regexp.
  # process_name = [".*nginx.*", ".*mysql.*"]

  # Process minimal run time(default 10m)
  # If process running time less than the setting, we ignore it(both for metric and object)
  min_run_time = "10m"

  ## Enable process metric collecting
  open_metric = false

  ## Enable listen ports tag, default is false
  enable_listen_ports = false

  ## Enable open files field, default is false
  enable_open_files = false

  ## only collect container-based process(object and metric)
  only_container_processes = false

  # Extra tags
  [inputs.host_processes.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"
  # ...

Once configured, restart DataKit.

Can be turned on by ConfigMap Injection Collector Configuration or Config ENV_DATAKIT_INPUTS .

Can also be turned on by environment variables, (needs to be added as the default collector in ENV_DEFAULT_ENABLED_INPUTS):

  • ENV_INPUT_HOST_PROCESSES_OPEN_METRIC

    Enable process metric collecting

    Type: Boolean

    input.conf: open_metric

    Default: false

  • ENV_INPUT_HOST_PROCESSES_PROCESS_NAME

    Whitelist of process

    Type: List

    input.conf: process_name

    Example: .*datakit.*,nginx

  • ENV_INPUT_HOST_PROCESSES_MIN_RUN_TIME

    Process minimal run time

    Type: Duration

    input.conf: min_run_time

    Default: 10m

  • ENV_INPUT_HOST_PROCESSES_ENABLE_LISTEN_PORTS

    Enable listen ports tag

    Type: Boolean

    input.conf: enable_listen_ports

    Default: false

  • ENV_INPUT_HOST_PROCESSES_TAGS

    Customize tags. If there is a tag with the same name in the configuration file, it will be overwritten

    Type: Map

    input.conf: tags

    Example: tag1=value1,tag2=value2

  • ENV_INPUT_HOST_PROCESSES_ONLY_CONTAINER_PROCESSES

    Only collect container process for metric and object

    Type: Boolean

    input.conf: only_container_processes

    Default: false

  • ENV_INPUT_HOST_PROCESSES_METRIC_INTERVAL

    Collect interval on metric

    Type: Duration

    input.conf: metric_interval

    Default: 30s

  • ENV_INPUT_HOST_PROCESSES_object_interval

    Collect interval on object

    Type: Duration

    input.conf: object_interval

    Default: 300s

Metric

For all of the following data collections, a global tag named host is appended by default (the tag value is the host name of the DataKit), or other tags can be specified in the configuration by [inputs.host_processes.tags]:

 [inputs.host_processes.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"
  # ...

host_processes

Per-process runtime metrics collected from operating-system process APIs.

Tags & Fields Description
cmdline
(tag)
Command line parameters for the process
container_id
(tag)
Container ID of the process, only supported Linux
host
(tag)
Host name
pid
(tag)
Process ID
process_name
(tag)
Process name
username
(tag)
Username
cpu_usage CPU usage, the percentage of CPU occupied by the process since it was started. This value will be more stable (different from the instantaneous percentage of top)
Type: float | (gauge)
Unit: percent,percent
Tagged by: cmdline, container_id, pid, process_name, username
cpu_usage_top CPU usage, the average CPU usage of the process within a collection cycle
Type: float | (gauge)
Unit: percent,percent
Tagged by: cmdline, container_id, pid, process_name, username
mem_used_percent Memory usage percentage
Type: float | (gauge)
Unit: percent,percent
Tagged by: cmdline, container_id, pid, process_name, username
nonvoluntary_ctxt_switches From /proc/[PID]/status. Context switches that nonvoluntary drop the CPU. Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
open_files Current number of open file descriptors for the process. Linux only.
Type: int | (gauge)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
page_children_major_faults Linux from /proc/[PID]/stat. The number of major page faults for this process. Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
page_children_minor_faults Linux from /proc/[PID]/stat. The number of minor page faults for this process. Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
page_major_faults Linux from /proc/[PID]/stat. The number of major page faults. Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
page_minor_faults Linux from /proc/[PID]/stat. The number of minor page faults. Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
proc_read_bytes Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Read bytes from disk
Type: int | (count)
Unit: digital,B
Tagged by: cmdline, container_id, pid, process_name, username
proc_syscr Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Count of read() like syscall`. Linux&Windows only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
proc_syscw Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Count of write() like syscall`. Linux&Windows only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
proc_write_bytes Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Written bytes to disk
Type: int | (count)
Unit: digital,B
Tagged by: cmdline, container_id, pid, process_name, username
rss Resident set size in bytes.
Type: int | (gauge)
Unit: digital,B
Tagged by: cmdline, container_id, pid, process_name, username
threads Current number of threads in the process.
Type: int | (gauge)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username
vms Virtual memory size in bytes.
Type: int | (gauge)
Unit: digital,B
Tagged by: cmdline, container_id, pid, process_name, username
voluntary_ctxt_switches From /proc/[PID]/status. Context switches that voluntary drop the CPU, such as sleep()/read()/sched_yield(). Linux only
Type: int | (count)
Unit: count
Tagged by: cmdline, container_id, pid, process_name, username

Object

host_processes

Per-process object records with identity, command, state, resource usage, and OS counter fields.

Tags & Fields Description
container_id
(tag)
Container ID of the process if the process is running in container, Linux only
host
(tag)
Host name
name
(tag)
Process object name field, consisting of [host-name]_[pid]
process_name
(tag)
Process name
state
(tag)
Process status. Supported on Linux and Windows
username
(tag)
Username
cmdline Command line parameters for the process.
Type: string | (string)
Unit: N/A
Tagged by: container_id, name, process_name, state, username
cpu_usage CPU usage, the percentage of CPU occupied by the process since it was started. This value will be more stable (different from the instantaneous percentage of top)
Type: float | (gauge)
Unit: percent,percent
Tagged by: container_id, name, process_name, state, username
cpu_usage_top CPU usage, the average CPU usage of the process within a collection cycle
Type: float | (gauge)
Unit: percent,percent
Tagged by: container_id, name, process_name, state, username
listen_ports JSON array of listening ports for the process.
Type: string | (string)
Unit: N/A
Tagged by: container_id, name, process_name, state, username
mem_used_percent Memory usage percentage
Type: float | (gauge)
Unit: percent,percent
Tagged by: container_id, name, process_name, state, username
message JSON summary of collected process tags, fields, memory info, and CPU time details.
Type: string | (string)
Unit: N/A
Tagged by: container_id, name, process_name, state, username
nonvoluntary_ctxt_switches From /proc/[PID]/status. Context switches that nonvoluntary drop the CPU. Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
open_files Current number of open file descriptors for the process. Linux only.
Type: int | (gauge)
Unit: count
Tagged by: container_id, name, process_name, state, username
page_children_major_faults Linux from /proc/[PID]/stat. The number of major page faults of its child processes. Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
page_children_minor_faults Linux from /proc/[PID]/stat. The number of minor page faults of its child processes. Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
page_major_faults Linux from /proc/[PID]/stat. The number of major page faults. Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
page_minor_faults Linux from /proc/[PID]/stat. The number of minor page faults. Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
pid Process ID.
Type: int | (gauge)
Unit: N/A
Tagged by: container_id, name, process_name, state, username
proc_read_bytes Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Read bytes from disk
Type: int | (count)
Unit: digital,B
Tagged by: container_id, name, process_name, state, username
proc_syscr Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Count of read() like syscall`. Linux&Windows only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
proc_syscw Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Count of write() like syscall`. Linux&Windows only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
proc_write_bytes Linux from /proc/[PID]/io, Windows from GetProcessIoCounters(). Written bytes to disk
Type: int | (count)
Unit: digital,B
Tagged by: container_id, name, process_name, state, username
rss Resident set size in bytes.
Type: int | (gauge)
Unit: digital,B
Tagged by: container_id, name, process_name, state, username
start_time Process start time as a Unix epoch timestamp in milliseconds.
Type: int | (gauge)
Unit: timeStamp,msec
Tagged by: container_id, name, process_name, state, username
started_duration Elapsed time since the process started, in seconds.
Type: int | (gauge)
Unit: time,s
Tagged by: container_id, name, process_name, state, username
state_zombie Whether the process is a zombie.
Type: bool | (bool)
Unit: bool
Tagged by: container_id, name, process_name, state, username
threads Current number of threads in the process.
Type: int | (gauge)
Unit: count
Tagged by: container_id, name, process_name, state, username
vms Virtual memory size in bytes.
Type: int | (gauge)
Unit: digital,B
Tagged by: container_id, name, process_name, state, username
voluntary_ctxt_switches From /proc/[PID]/status. Context switches that voluntary drop the CPU, such as sleep()/read()/sched_yield(). Linux only
Type: int | (count)
Unit: count
Tagged by: container_id, name, process_name, state, username
work_directory Working directory of the process. Linux only.
Type: string | (string)
Unit: N/A
Tagged by: container_id, name, process_name, state, username

Feedback

Is this page helpful? ×