Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upa question about prometheus example.rules #2456
Comments
This comment has been minimized.
This comment has been minimized.
This expression is an addition of matching vector elements. Since there are no matching vector elements, the result is empty, and the alert doesn't fire. What you want is an aggregation:
In different news, it makes more sense to ask quastions like this on the prometheus-users mailinglist rather than filing a GitHub issue. |
beorn7
closed this
Mar 1, 2017
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 23, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
xuxiali13 commentedMar 1, 2017
The problems of scene description:
the prometheus collect the bandwidth from nginx, and it will send alert message to alertmanager when bandwidth reached the threshold seted, also, alertmanager send alert to nginx meanwhile.
I make http requests to nginx, and the bandwidth prometheus collected is display:
job="prometheus",servername="www.at.com"} 611005
job="prometheus",servername="www.bt.com"} 400732
If I config "example.rules" as follows:
prometheus:ngx_bandwidth:sum = sum(ngx_bandwidth) by (job,servername)
ALERT APINGXBANDWIDTH
IF prometheus:ngx_bandwidth:sum{servername="www.at.com"} > 100
FOR 2s
LABELS { service = "bandwidth" }
ANNOTATIONS {
summary = "{{ $labels.job }} {{$labels.value}}",
description = "{{ $value }}",
}
the alertmanager will receive the alert message from prometheus.
But, ,If I config "example.rules" as follows:
prometheus:ngx_bandwidth:sum = sum(ngx_bandwidth) by (job,servername)
ALERT APINGXBANDWIDTH
IF prometheus:ngx_bandwidth:sum{servername="www.at.com"} + prometheus:ngx_bandwidth:sum{servername="www.bt.com"}> 100
FOR 2s
LABELS { service = "bandwidth" }
ANNOTATIONS {
summary = "{{ $labels.job }} {{$labels.value}}",
description = "{{ $value }}",
}
the alertmanager cann't receive the alert message from prometheus .
why? help me, thanks.