go – How to use regex in the Grafana Message Template and replace it
When an alert occurs, I want to create a template using Prometheus metric and value.
There was no problem when the value string is 1 array string, but there is a problem when there are N.
e.g)
ValueString: [ var=”A0″ metric=”a” labels={labelA=a} value=8567.233333333334 ], [ var=”A1″ metric=”b” labels={labelA=b} value=7853.116666666667 ]
as-is template: {{ reReplaceAll “(.) (value=)([0-9]+)(.)” “* current: $3” .ValueString }}
How can I get the value and value of labelA from the ValueString above and use it for template?
— expect result
labelA: a, current: 8567
labelA: b, current: 7853
Read more here: Source link