thanks, it's ok now!

在2021年1月28日星期四 UTC+8 下午4:36:39<matt...@prometheus.io> 写道:

> Your expression aggregates away all labels, including instance. As 
> written, this alert would only fire if exactly one instance is down, not if 
> two are down. Try removing the count altogether:
>
> up{group="tty",job="test101"} == 0
>
> will tell you per-instance when they cannot be scraped.The Alertmanager 
> can group all of these together so you get one notification.
>
> /MR
>
> On Thu, Jan 28, 2021 at 8:12 AM guo galen <galen....@gmail.com> wrote:
>
>> use:
>>  prometheus-2.24.1.linux-amd64.tar.gz  
>>  alertmanager-0.21.0.linux-amd64.tar.gz
>>
>> 在2021年1月28日星期四 UTC+8 下午3:49:28<guo galen> 写道:
>>
>>> 1. rule.yml:
>>> groups:
>>> - name: test_alert
>>>   rules:
>>>
>>>   - alert: xxx-shutdown
>>>     expr:  count(up{group="tty",job="test101"} == 0 ) == 1
>>>     for: 30s
>>>     labels:
>>>       severity: emergency
>>>       reporter: prometheus
>>>     annotations:
>>>       summary:  "{{ $labels.instance }} shutdown"
>>>       description: "{{ $labels.group }} of job {{ $labels.job}} shutdown"
>>>
>>> 2. get alert message like below:
>>>
>>> [FIRING:1] 
>>> Alerts Firing
>>>
>>> [EMERGENCY]  shutdown
>>> Description: of job shutdown
>>>
>>> Graph: 📈
>>>
>>> Details:
>>>
>>> alertname: xxx-shutdown
>>> reporter: prometheus
>>>
>>>
>>> -- 
>> 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 prometheus-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/05276fe5-c5a6-45f0-9701-f256e4882a32n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/05276fe5-c5a6-45f0-9701-f256e4882a32n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4b599a46-842c-48f4-bdc8-9ee8a8f391dbn%40googlegroups.com.

Reply via email to