0

Currently I have a simple alerting rule set up that uses the "probe_success" metric from Blackbox Exporter to alert when a probe is down, kinda obvious.

A requirement is that the status code of the request that failed is included in the alert. So instead of only saying "... is down", it should have the status code ("probe_http_status_code") in it, like "... is down (500)".

Because the status code is the value of the "probe_http_status_code" I can't join the labels of both "probe_success" and "probe_http_status_code" to get the result I want.

I also read that metric values can't be joined as labels, which was a disappointment. https://github.com/prometheus/prometheus/issues/2393

I haven't found anything else in regards to passing PromQL expressions as separate labels in the alerting rule itself either.

I know that I haven't put much "what have you tried already?" examples in here, but honestly, I'm all over the place with trying stuff to get this to work and I don't have any solid "I've tried this" examples".

Julian
  • 837
  • 1
  • 11
  • 24

1 Answers1

2

You can use and for this:

probe_http_status_code and probe_success == 0

as both metrics have the same labels. The value of the alerting expression will then be the status code.

brian-brazil
  • 31,678
  • 6
  • 93
  • 86