Metric labels enable users to filter metrics efficiently in the Graphs Dashboard. This functionality is available for all G1 and G2 metrics from Agent version 19.0.0.
To configure metric labels, follow the steps below:
Step 1: Create a Metric Configuration YAML File
Create a configuration file named MetricLabel_config.yaml
in the agent/conf
folder using the following format:
resource_level_labels:
- <key>: <key value>
<key>: <key value>
<key>: <key value>
metrics_specific_labels:
metrics:
- name: metric_name_1
common_metric_labels:
key1: value1
key2: value2
instances:
- instance_name: instance_name_1
key3: value3
key4: value4
- instance_name: instance_name_2
key3: value5
key4: value6
- name: metric_name_2
common_metric_labels:
key1: value1
key2: value2
instances:
- instance_name: instance_name_3
key3: value7
key4: value8
- instance_name: instance_name_4
key3: value9
key4: value10
Explanation of YAML Fields
resource_level_labels
: These labels apply to all metrics sent by the Agent.metrics_specific_labels
: Labels specific to particular metrics (supports regex format).common_metric_labels
: Labels common across all instances of a particular metric.instance_name labels
: Labels specific to individual metric instances (supports regex format).
Step 2: Restart the Agent
After configuring the MetricLabel_config.yaml
file, restart the Agent. Any changes to the file require an Agent restart to take effect.
Example Configuration File
Here is an example configuration file:
resource_level_labels:
- env: production
site: sic
os_type: windows
os_name: windows server 2016
metrics_specific_labels:
metrics:
- name: system.disk.usage.usedspace
common_metric_labels:
disk: "Disk utilization monitoring"
description: "Tracks disk usage percentage"
instances:
- instance_name: c
keyA: valueA
keyB: valueB
- instance_name: d
keyC: valueC
keyD: valueD
- name: system.memory.usage.utilization
common_metric_labels:
memory: "Memory utilization monitoring"
description: "Tracks memory usage percentage"
instances:
- instance_name: physical
keyE: valueE
keyF: valueF
- instance_name: virtual
keyG: valueG
keyH: valueH