It is not possible to use relabelling to add labels to the up
metric. This is what I remember from the book by Brian - "Prometheus: Up & Running".
I'm wondering then how to add there labels in the case that I don't control the Prometheus exporter.
It is true that metric_relabel_configs doesn't apply to up
because:
Metric relabeling does not apply to automatically generated timeseries such as
up
.
But, if you really need it, relabel_config can add the label at configuration time (or using labels
config of static_config):
relabel_configs:
- source_labels: job
target_label: my_new_label
replacement: label_value
Using relabel_config
will add the label to all metrics ingested and if you need it to apply to up
only, you can drop it at ingest time for all metrics:
metric_relabel_configs:
- regex: my_new_label
action: labeldrop