Name and ID string template is blank


I’m trying to send alerts to Alerta but I’m getting an error that ‘resource’ and ‘event’ are required fields. I’m using YAMLs for my event handler and task templates.

**My alerta handler:**
id: main-alerta
topic: main
kind: alerta 
  token: 'F_pTpZc0zhMz4C46fmpdv2sRPKQGUBHGXXXXXXXX'
  token-prefix: 'Key'
  resource: '{{ .Name }}'
  event: '{{ .ID }}'
  group: '{{ .Group }}'
  origin: 'kapacitor'

**My task template:**
    template-id: main-mean
        type: string
        value: cpu
        type: lambda
        value: "\"cpu\" == 'cpu-total'"
        type: list
          - type: string
            value: "host"
      field :
        type: string
        value: usage_idle
      warn :
        type: lambda
        value: "\"mean\" < 30.0"
      crit :
        type: lambda
        value: "\"mean\" < 10.0"
      window :
        type: duration
        value: 1m

**My tick script:**
    dbrp "telegraf"."autogen"

    var measurement string
    var where_filter = lambda: TRUE
    var groups = [*]
    var field string
    var warn lambda
    var crit lambda
    var window = 10s
             .id('kapacitor/{{ .Name }}/{{ .Group }}')

When the alert is triggered, I see in the logs that Alert id is “kapacitor//” so it seems that I couldn’t get the .Name and the .Group substitution.

Please advise.


I figured it out. Since I was using Helm Charts to deploy the Kapacitor files, it was substituting the templates with empty string. Solution is to escape the double curly braces in the Kapacitor string templates.