v-m: Add host labels to collectd-virt metrics
The *virt* plugin for *collectd* sets `instance` to the name of the libvirt domain the metric refers to. This makes it so there is no label identifying which host the VM is running on. Thus, if we want to classify metrics by VM host, we need to add that label explicitly. Since the `__address__` label is not available during metric relabeling, we need to store it in a temporary label, which gets dropped at the end of the relabeling phase. We copy the value of that label into a new label, but only for metrics that match the desired metric name.dch-webhooks-secrets
parent
50beecf0a9
commit
ca02dfec62
|
@ -80,9 +80,21 @@ scrape_configs:
|
||||||
- files:
|
- files:
|
||||||
- /scrape/collectd/scrape-collectd.yml
|
- /scrape/collectd/scrape-collectd.yml
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
|
- source_labels:
|
||||||
|
- __address__
|
||||||
|
target_label: host__tmp
|
||||||
- source_labels: [__address__]
|
- source_labels: [__address__]
|
||||||
target_label: __address__
|
target_label: __address__
|
||||||
replacement: '$1:9103'
|
replacement: '$1:9103'
|
||||||
|
metric_relabel_configs:
|
||||||
|
- source_labels:
|
||||||
|
- __name__
|
||||||
|
- host__tmp
|
||||||
|
separator: ;
|
||||||
|
regex: collectd_virt.*;(.*)
|
||||||
|
target_label: host
|
||||||
|
- action: labeldrop
|
||||||
|
regex: host__tmp
|
||||||
|
|
||||||
- job_name: sambadc
|
- job_name: sambadc
|
||||||
scrape_interval: 1m
|
scrape_interval: 1m
|
||||||
|
|
Loading…
Reference in New Issue