Hi Julius,

Let me explain my use case.
For notices that alert-manger sent by receivers, I'm going to write a 
webhook to store them and show them on a website.  
Let's say notice-A got sent by a mail-receiver and a wechat-receiver to a 
user. What I wanna do is to enable the user to be able to click a link 
within the notice-A, to navigate it on the website.
Apparently every notice should have an ID that is generated by the 
Prometheus, which evaluate the Alert Expression and send alerts to 
alert-manager.
After going through all documents I have, still no luck to find such a 
function to generate a GUID for me.


在 2020年5月20日星期三 UTC+8下午3:12:51,Julius Volz写道:
>
> Not sure what exactly your use case is, but if you just want the current 
> (at the time of alert evaluation) Unix timestamp in an annotation, you 
> should be able to do:
>
> {{ with query "time()" }}{{ . | first | value }}{{ end}}
>
> Note that the "Alert" struct on the Alertmanager templating side will also 
> have timestamp fields on it that tell you when an alert first started 
> firing, and when it will expire if it's no longer sent from Prometheus:
>
> https://prometheus.io/docs/alerting/notifications/#alert
>
>
>
> On Wed, May 20, 2020 at 5:59 AM zichen chuh <[email protected] 
> <javascript:>> wrote:
>
>> I went through documents given by prometheus website and didn't find a 
>> clue.
>>
>> From alerting_rules 
>> <https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/#templating>
>>  , 
>> only 3 variables are available : $lables, $externalLabels, $value.
>>
>> Thanks in advance.
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/d5b9244a-1582-4816-a314-9b7c9917aa10%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/d5b9244a-1582-4816-a314-9b7c9917aa10%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Julius Volz
> PromLabs - promlabs.com
>

-- 
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/036fc7a6-0937-4e89-b0ff-9df94f8a71efo%40googlegroups.com.

Reply via email to