Dear Brian Candlers, Thanks for answer :)
That's really solved my problem. Now I can proceed with testing alertmanager Regards Em quinta-feira, 20 de junho de 2024 às 14:04:40 UTC-3, Brian Candler escreveu: > If you put multiple matchers, they must all be true to match ("AND" > semantics). So when you wrote > > - matchers: > - alertname = "SystemdUnitDown" > - alertname = "InstanceDown" > > it means alertname must be simultaneously equal to both those values, > which can never be true. > > One solution is to rewrite your matchers, such as > > - matchers: > - alertname =~ "SystemdUnitDown|InstanceDown" > > Personally though I find it easier to structure my rules the other way > round: when a condition matches list all the receivers who should receive > this alert. You can do this using nested routing rules ("routes" instead of > "receiver"). For example, for the InstanceDown alert: > > - matchers: > - alertname = "InstanceDown" > routes: [ { receiver: Team1, continue: true }, { receiver: Team2 } ] > #continue: true > > The magic here is that the nested routes don't have any matchers, so they > always match and deliver to the receiver. > > You then don't need the top-level "continue: True" either (I've shown it > commented out), since once this condition matches, you've finished all the > processing for InstanceDown and you don't need to test any subsequent rules. > > On Thursday 20 June 2024 at 14:44:57 UTC+1 Alexander Varejão wrote: > >> Hi, >> >> I need help again :( >> >> I am trying to configure my Alertmanager to send separate alerts without >> success. >> >> Basically, I need to trigger two alerts for two different groups via >> Telegram. >> >> So, I created two alerts (Alert1 and Alert2) and two teams (Team1 and >> Team2). >> >> Team1 should only receive Alert1, while Team2 should receive both alerts >> (Alert1 and Alert2). >> >> However, only Team 2 is receiving the alerts. I don't know what is wrong. >> Could someone help me find the error in my configuration? >> >> [...] >> route: >> group_by: ["instance"] >> receiver: 'Team2' >> routes: >> - matchers: >> - alertname = "InstanceDown" >> receiver: 'Team2' >> continue: true >> - matchers: >> - alertname = "SystemdUnitDown" >> - alertname = "InstanceDown" >> receiver: 'Team1' >> continue: true >> >> receivers: >> - name: 'Team1' >> email_configs: >> - to: 'email@domain' >> send_resolved: true >> html: '' >> text: "Summary: {{ .CommonAnnotations.summary }}\ndescription: >> {{ .CommonAnnotations.description }}\n\n" >> telegram_configs: >> - api_url: 'https://api.telegram.org' >> chat_id: -ID_HERE >> bot_token: -TOKEN_HERE >> - name: 'Team2' >> telegram_configs: >> - api_url: 'https://api.telegram.org' >> chat_id: -ID_HERE >> bot_token: -SAME_TOKEN_HERE >> [...] >> >> Tanks >> > -- 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/b5a02952-d980-4e30-8e8a-06474b672c68n%40googlegroups.com.