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_nameexe_pathargs
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_processis created. - The receiver monitors processes named
example. - Metrics are collected only from nodes that:
- Have the label
os=linux, or - Have the hostname
node1ornode2.
- Have the label
Replace these sample values with the process names, labels, hostnames, and paths used in your environment.
4. Review the configuration parameters
| Parameter | Required | Description |
|---|---|---|
enabled | Yes | Enables or disables the node_hostmetrics receiver. Set to true to start collecting host and process metrics. |
scrape_interval | No | Frequency at which host and process metrics are collected. The example uses a 2-minute interval. |
group_process_configs | Yes (for process monitoring) | List of process group configurations. Use an empty list if process monitoring is not required. |
group_name | Yes | Unique name assigned to a process group. |
targetNodeSelector | No | Restricts monitoring to nodes that match specific labels or hostnames. |
process_name | At least one selector required | List of process names to monitor. Matching is OR-based. |
exe_path | At least one selector required | List of executable paths to monitor. Matching is OR-based. |
args | At least one selector required | List of command-line arguments used to identify processes. Matching is AND-based. |
match_type | Yes (for each selector) | Matching method used by process_name, exe_path, or args. Supported values: strict and regexp. |
Each process group must include at least one process selector:
process_nameexe_pathargs
If multiple selectors are configured, matching is evaluated in the following order:
process_nameexe_pathargs
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
Note
The Host Metrics receiver is configured usingopsramp-workload-metric-user-config, but the active receiver configuration can be verified through opsramp-k8s-infra-metric-user-config.Supported metrics
| Metric Name | Description |
|---|---|
| process.cpu.time | Total CPU time consumed by the monitored process group. |
| process.memory.usage | Physical memory used by the monitored process group. |
| process.memory.virtual | Virtual memory used by the monitored process group. |
| process.disk.io | Disk bytes read and written by the monitored process group. |
| process.threads | Number of threads used by the monitored process group. |