1

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
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Rightly
  • 31
  • 2

0 Answers0