Kapacitor: Number formating in alert message or details

Created on 21 Apr 2016  路  2Comments  路  Source: influxdata/kapacitor

Perhaps it already exists, and I can't figure it out, but is there a way to format numbers?
Exemple:
I would like to have value 3.3333333333 writen like this 3.33
and value 6.666666666 writen like 6.66

prebuild kapacitor 0.11

Most helpful comment

@jdursel In which context are you formatting numbers? Alert messages?

In alert messages you can use the printf function {{ index .Fields "value" | printf "%0.2f" }} see https://golang.org/pkg/text/template/ and https://golang.org/pkg/fmt/ for more details.

All 2 comments

@jdursel In which context are you formatting numbers? Alert messages?

In alert messages you can use the printf function {{ index .Fields "value" | printf "%0.2f" }} see https://golang.org/pkg/text/template/ and https://golang.org/pkg/fmt/ for more details.

Yes, indeed, this is in alert messages.
Thank you :-)

Was this page helpful?
0 / 5 - 0 ratings