Hello,
I have some devices where I installed the vendor specifc plugin to export metrics via Open telemetry to the prometheus server.
The device is configured to collect the metrics on its own and then push the data to the prometheus server.
For this I configured “remote_write”:
remote_write:
I receive data from the device, so connection and communication is working.
However the device device is missing some information I want to add. If possible I want to add an additional label to ALL metrics of this remote_write URL and the value of the metric should be the hostname or the IP-address of the device which sent the metrics.
I tried with the “write_relable_config” but I do not get any new lables in my metrics.
remote_write:
- url: “https://hostname.my.domain:9090/api/v1/otlp/v1/metrics”
write_relabel_configs:- source_labels: [name, address, scheme, metrics_path, scrape_interval, scrape_timeout, _meta, __tmp]
separator: “@”
regex: “(.*)”
replacement: “value_of_label_03”
target_label: “new_label_03”
action: “replace”
- source_labels: [name, address, scheme, metrics_path, scrape_interval, scrape_timeout, _meta, __tmp]
“write_relabel_configs” is the only option whcih semms to be valid for “remote_write”. “metric_relabel_config” is not working - but I do not know if thios would work or not.
How can I add an additional label to ALL metrics received by the specific remote_write URL or is this not possible in this specific constellation?
I am running prometheus 2.48.0 on linux.
I appreciate any kind of help. I am not very familar with prometheus so if you have any advice please add as much details as you can so that I am able to check and verify if it works.
Thanks in advance!