This is not how labels in templating work.
Syntax {{ $labels.probe_http_status_code }} supposed to include label
probe_http_status_code from your alert.
You can include results of other queries with pattern like {{ printf "
probe_http_status_code { app ='%s', env ='%s', customer ='%s' }" .Labels.
app .Labels. env .Labels. customer | query | first | value }}
понедельник, 25 сентября 2023 г. в 20:36:40 UTC+3, Jason:
> Hi dear Community
>
> I wish to output the metrics of blackbox_exporter
>
> - probe_failed_due_to_regex
> - probe_http_status_code
>
> in alert mail
>
> At the moment I do this, but it's not working
>
>
> - alert: Blackbox-Probe-Result
> expr: probe_success{app="ZZY", env="Prod", customer="OOO"} != 1
> for: 1m
> labels:
> severity: warning
> annotations:
> summary: PPP
> description: HTTP probe of {{ $labels.instance }} failed.
> Regex Matching "probe_failed_due_to_regex" is {{
> $labels.probe_failed_due_to_regex }} and the HTTP status code is {{
> $labels.probe_http_status_code }}.
>
>
> I found with a web
> searchhttps://
> stackoverflow.com/questions/57022903/blackbox-exporter-alert-with-value-of-the-probe-http-status-code-metric
>
> I did not understand it, why needed.
>
> Any ideas?
>
> Kind regards
> Jason
>
--
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/191fd9d2-0a72-4fc1-947a-eb90407235a0n%40googlegroups.com.