tell me the best way to fix an undefined variable label in prometheus?

It seems you are deploying your Prometheus setup via a helm chart. This causes an issue as the same delimiters ({{ and }}) are used both by helm templating and the alerting templating in Prometheus.

The {{ $labels.myData }} has to reach prometheus config intact, so helm must not process it.

The simplest way would be to use:

{{ "{{" }} $labels.myData }}

The {{ "{{" }} block will be processed by helm and will produce {{ as a result with rest of the line not being altered and will get you the result you need.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top