Overview

The node_hostmetrics receiver collects host-level metrics from Kubernetes nodes and can monitor specific processes running on those nodes.

You can group processes based on:

  • Process name
  • Executable path
  • Command-line arguments

You can also restrict monitoring to specific nodes by using labels or hostnames.

Host Metrics helps you understand the resource consumption and activity of critical processes, such as Kubernetes components and infrastructure services running on your nodes.

Before you begin

Ensure that:

  • You know which processes you want to monitor.
  • The target nodes have the labels or hostnames you plan to use for node selection.
  • You have permission to update receiver ConfigMaps.
  • At least one process selector is defined for each process group:
    • process_name
    • exe_path
    • args

Configure the Host Metrics Receiver

1. View the current ConfigMap

View the current infrastructure metrics configuration:

kubectl get cm opsramp-k8s-infra-metric-user-config -n <agent-installed-namespace> -o yaml

Locate the node_hostmetrics section. By default, the receiver is disabled:

node_hostmetrics:
  enabled: false
  config:
    scrape_interval: "2m"
    group_process_configs: []

2. Edit the Host Metrics configuration

The Host Metrics receiver configuration is managed through the opsramp-workload-metric-user-config ConfigMap.

Open the ConfigMap for editing:

kubectl edit cm opsramp-workload-metric-user-config -n <agent-installed-namespace>

3. Enable the Receiver

Set enabled to true and define the processes you want to monitor.

apiVersion: v1
kind: ConfigMap
metadata:
  name: opsramp-workload-metric-user-config
  namespace: opsramp-agent
data:
  hostmetrics: |
    node_hostmetrics:
      enabled: true
      config:
        scrape_interval: "2m"
        group_process_configs:
          - group_name: "example_process"
            targetNodeSelector:
              matchLabels:
                - key: os
                  operator: ==
                  value:
                    - linux
              matchHostNames:
                - node1
                - node2
            process_name:
              names:
                - "example"
              match_type: "strict"
            exe_path:
              names:
                - "/path/to/example"
              match_type: "strict"
            args:
              names:
                - "--arg=/arg/1.*"
              match_type: "regexp"    

In this example:

  • A process group named example_process is created.
  • The receiver monitors processes named example.
  • Metrics are collected only from nodes that:
    • Have the label os=linux, or
    • Have the hostname node1 or node2.

Replace these sample values with the process names, labels, hostnames, and paths used in your environment.

4. Review the configuration parameters

ParameterRequiredDescription
enabledYesEnables or disables the node_hostmetrics receiver. Set to true to start collecting host and process metrics.
scrape_intervalNoFrequency at which host and process metrics are collected. The example uses a 2-minute interval.
group_process_configsYes (for process monitoring)List of process group configurations. Use an empty list if process monitoring is not required.
group_nameYesUnique name assigned to a process group.
targetNodeSelectorNoRestricts monitoring to nodes that match specific labels or hostnames.
process_nameAt least one selector requiredList of process names to monitor. Matching is OR-based.
exe_pathAt least one selector requiredList of executable paths to monitor. Matching is OR-based.
argsAt least one selector requiredList of command-line arguments used to identify processes. Matching is AND-based.
match_typeYes (for each selector)Matching method used by process_name, exe_path, or args. Supported values: strict and regexp.

5. Save the configuration

Save the ConfigMap and exit the editor.

The updated configuration is automatically applied to the cluster.

6. Verify the configuration

After saving the changes, verify that the receiver configuration is available through the infrastructure metrics ConfigMap:

kubectl get cm opsramp-k8s-infra-metric-user-config -n <agent-installed-namespace> -o yaml

Supported metrics

Metric NameDescription
process.cpu.timeTotal CPU time consumed by the monitored process group.
process.memory.usagePhysical memory used by the monitored process group.
process.memory.virtualVirtual memory used by the monitored process group.
process.disk.ioDisk bytes read and written by the monitored process group.
process.threadsNumber of threads used by the monitored process group.