Hi,
On 1/3/20 6:41 AM, Romenyrr wrote:
> |
> level=error
> ts=2020-01-03T05:36:34.129Zcaller=dispatch.go:301component=dispatcher
> msg="Notify for alerts failed"num_alerts=1err="cancelling notify retry
> for \"opsgenie\" due to unrecoverable error: unexpected status code 422:
> {\"message\":\"Request body is not processable. Please check the
> errors.\",\"errors\":{\"priority\":\"should be one of [ P1, P2, P3, P4,
> P5
> ]\"},\"took\":0.001,\"requestId\":\"c4589a15-34e6-4530-8dde-d45f3557f6f4\"}"
> |
>
> Cleaned up Define block:
>
> |
> {{ define "opsgenie.myorg.priority"}}
> {{ range .Alerts }}
> {{ if eq .Labels.severity "critical"}}
> P1
> {{ else }}
> P3
> {{ end }}
> {{ end }}
> {{ end }}
> |
Just a very blind guess without having tried and without knowning
OpsGenie: Could this be whitespace-related? Your template probably
returns " <lots of spaces> P1 <lots of spaces> ", which might make it
break?
Try removing all spaces for debugging and/or adding a dash in your
template tags (such as {{- end -}}).
https://golang.org/pkg/text/template/#hdr-Text_and_spaces
(In addition to what Simon said about multiple alerts)
Kind regards,
Christian