I just came across this problem and the solution is to use a group_left to resolve this problem. You can’t relabel with a nonexistent value in the request, you are limited to the different parameters that you gave to Prometheus or those that exists in the module use for the request (gcp,aws…).
So the solution I used is to combine an existing value containing what we want (the hostnmame
) with a metric from the node exporter. Our answer exist inside the node_uname_info
metric which contains the nodename
value.
I used the answer to this post as a model for my request: https://stackoverflow.com/a/50357418 .
The solution is this one:
node_memory_Active_bytes
* on(instance) group_left(nodename)
node_uname_info
With this, the node_memory_Active_bytes
metric which contains only instance
and job
labels by default, gets an additional nodename
label that you can use in the description field of Grafana.
Hope that this will help others.