1
0
Fork 0

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
Dustin 2024-01-22 11:12:19 -06:00
parent 50beecf0a9
commit ca02dfec62
1 changed files with 12 additions and 0 deletions

View File

@ -80,9 +80,21 @@ scrape_configs:
- files:
- /scrape/collectd/scrape-collectd.yml
relabel_configs:
- source_labels:
- __address__
target_label: host__tmp
- source_labels: [__address__]
target_label: __address__
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
scrape_interval: 1m