Hi folks, how are you?
We need to manipulate the .GeneratorURL.
For example:
*.GeneratorURL*:
https://<prometheus_url>/graph?g0.expr=(sum(up))%20and%20on()%20(is_metrics_platform_up%20%3D%3D%201)&g0.tab=1&g0.stacked=0&g0.show_exemplars=0&g0.range_input=1h
I need to remove: *%20and%20on()%20(is_metrics_platform_up%20%3D%3D%201)*
In the real world, I could get each parameter, decode it, remove the suffix
and encode again to generate a new GeneratorURL, but in the alertmanager
template I do not know how to do this.
The only way to that I found, is
{{ define "url" -}}
{{if and (eq .GroupLabels.env "prod") (contains (index .Alerts
0).GeneratorURL "is_metrics_platform_up") }}
{{js (index .Alerts 0).GeneratorURL | reReplaceAll
"%20and%20on()%20(is_metrics_platform_up%20%3D%3D%201)" "" }}
{{ else }}
{{ (index .Alerts 0).GeneratorURL }}{{ end }}{{ end }}
Is there a way to do this more elegant?
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/b1c9b17e-80dd-4f6f-b448-2e108efaa269n%40googlegroups.com.