如果每个同一个网关的last_hour_mins_average_status
> 3.4和last_five_mins_requests_to_gateway_gauge_count
> 75,则需要创建警报。有以下输入:
# HELP last_five_mins_requests_to_gateway_gauge_count labels: gatewayId
# TYPE last_five_mins_requests_to_gateway_gauge_count gauge
last_five_mins_requests_to_gateway_gauge_count{gatewayId="34"} 1
last_five_mins_requests_to_gateway_gauge_count{gatewayId="38"} 32
last_five_mins_requests_to_gateway_gauge_count{gatewayId="44"} 34
last_five_mins_requests_to_gateway_gauge_count{gatewayId="51"} 23
last_five_mins_requests_to_gateway_gauge_count{gatewayId="68"} 14
last_five_mins_requests_to_gateway_gauge_count{gatewayId="75"} 1
last_five_mins_requests_to_gateway_gauge_count{gatewayId="76"} 71
last_five_mins_requests_to_gateway_gauge_count{gatewayId="79"} 1
和
# HELP last_hour_mins_average_status Average value by message status by last 60 minutes
# TYPE last_hour_mins_average_status gauge
last_hour_mins_average_status{gatewayId="34"} 1.6923
last_hour_mins_average_status{gatewayId="38"} 1.5004
last_hour_mins_average_status{gatewayId="44"} 1.1569
last_hour_mins_average_status{gatewayId="51"} 1.7835
last_hour_mins_average_status{gatewayId="62"} 8.0000
last_hour_mins_average_status{gatewayId="68"} 1.3075
last_hour_mins_average_status{gatewayId="75"} 1.2727
last_hour_mins_average_status{gatewayId="76"} 1.3703
last_hour_mins_average_status{gatewayId="78"} 1.0000
last_hour_mins_average_status{gatewayId="79"} 2.1622
我创建了查询A:
avg_over_time(lox24_sms_last_five_mins_requests_to_gateway_gauge_count[1m])
并查询B:
avg_over_time(lox24_sms_last_hour_mins_average_status[1m])
和警报条件(UI表单):
when avg() of query(A, 5m, now) is above 75
and avg() of query(B, 5m, now) is above 3.4
并且当any gatewayId的邮件数> 75并且ANY gatewayId的平均状态> 3.4时,就会发生警报。
但是,只有当这两个条件都发生在相同的gatewayId上时,我才需要发出警报。
答案 0 :(得分:2)
以下是应该执行的Prometheus查询(尚未测试,但应该可以工作):
last_five_mins_requests_to_gateway_gauge_count > 75
and
last_hour_mins_average_status > 3.4