Prometheus config job template

Hi,

I have a template with prometheus configuration and it uses $labels from prometheus.
Using this with the artifact+template stanza to deploy a job gives me an error parsing this kind of variables. Is there a way to force the template stanza to parse all the iles as raw?

Thanks,
Bruno

Hi Bruno, could you paste the error message and a simple of example of how to reproduce your problem?

Can you reproduce this just using the template stanza with the data property https://www.nomadproject.io/docs/job-specification/template.html#data: e.g.:

template {
 data = <<EOH
 ---
   bind_port:   {{ env "NOMAD_PORT_db" }}
   scratch_dir: {{ env "NOMAD_TASK_DIR" }}
   node_id:     {{ env "node.unique.id" }}
   service_key: {{ key "service/my-key" }}
 EOH

 destination = "local/file.yml"
}

Hi Raphael, thanks for the reply.

$labels are internal to prometheus, it’s no an env var.
I’ve managed to use it like this:

{{ “{{” }} $labels {{ “}}” }} inside the template. This way the consul template parses this without messing with the internal $labels var.

Thanks