grafana
grafana copied to clipboard
Environment variables in rule expression provisioning
Discussed in https://github.com/grafana/grafana/discussions/65343
Originally posted by mjako78 March 27, 2023
Hi, I ran into a little downside in provisioning an alerting rule in Grafana.
Grafana does not allow to interpolate an environment variable in the rule model expression to prevent error in macros that need to stay as-in. Such as $__timeFilter.
I was thinking if it is possible to achieve both cases, maybe using a double dollar sign $$ to treat the following expression as an environment variable, only in the rule model?
$$MY_ENV_VAR --> interpolate and do env var subsitution
$__timeFilter --> stay as is
For reference, this is the question I opened some days ago in community forum, with the answer that was given to me clarifying such behavior. https://community.grafana.com/t/environment-variables-in-rules-provisioning/83556