Использование alert_relabel_configs

Переназначение меток в Prometheus используется чаще всего в секции scrape_configs — после списка таргетов идет опция relabel_configs. Для большинства хорошо понятно как она работает — есть исходная метрика (source_labels), есть целевая (target_label). Где-то в «середине» напрямую или с ипользованием регулярок идет извлечение значения, его изменение и сохранение в целевой метке.

Тем не менее есть и ряд других мест, где релейблинг может оказаться очень полезным. В этой статье я напомню о них.

Использование alert_relabel_configs

Как может быть понятно из названия статьи, речь пойдет именно о alert_relabel_configs. Однако релейблинг очень мощный инструмент управления метриками, встречающийся и в других секциях конфигурации 1, имея при этом везде одинаковый синтаксис.

Возьмем в качестве примера ситуацию с простым алертом:

Его важность — critical — и например в алертменеджере для алертов с такой важностью предусмотрен срочный звонок сисадминам. Но что, если есть не особо важные хосты, возможно для тестирования, либо просто с низкоприоритетной нагрузкой, по которым срочно звонить дежурным не надо? Как их исключить? Варианты есть.

Можно просто добавить имя хоста в исключения в алерте напрямую:

Минусы очевидны — представьте, если у вас таких хостов 10 или 1000. Более предпочтительным вариантом будет выставить в списке таргетов для таких хостов определенную метку (см. severity_rewrite):

Далее в алерте делаем обработку этого лейбла:

Тогда придется написать второй алерт с другим значением лейбла (или с его отсутствием), что усложнит конфигурацию. Гораздо лучше добавить сложное условие в severity, тогда и алерты плодит не придется:

Уже лучше, но неужели вы так будете делать для каждого алерта? Получается слишком громоздко, да и велико влияние человеческого фактора.

Есть возможность переопределять значение лейбла централизованно в секции alerting. Для этого нужно использовать опцию alert_relabel_configs. Выглядит это следующим образом:
alerting:

Тут мы склеиваем два лейбла (разделитель по умолчанию — «;«), после чего проверяем регуляркой значение обоих и если оно совпадает с паттерном, то выполняем изменение лейбла severity.

Примечание: алерты тоже являются метриками (вы можете подергать их запросом {__name__=~»ALERTS.*»}, но управлять их лейблами вы не сможете из секции scrape_configs, это можно сделать только из alert_relabel_configs.

Помните, что метки меняются только перед отправкой в алертменеджер, поэтому в самом прометее вы увидите значение severity, которое указано в правиле алерта:

Но в алертменеджере будет ожидаемо severity=»warning»:

В итоге все алерты для данного хоста будут иметь пониженный приоритет. Сами правила алертинга останутся неизменными, что несомненно огромный плюс. На этом все.

comments powered by HyperComments
law dissertation writing service
2022-07-05 14:34:51
<strong>dissertation database https://professionaldissertationwriting.org/</strong>
how long should a dissertation be lse
2022-07-05 18:27:51
<strong>uk dissertation writing help quotes https://professionaldissertationwriting.com/</strong>
dissertation acknowledgement sample
2022-07-05 21:35:30
<strong>phd dissertation https://helpwithdissertationwritinglondon.com/</strong>
online edd no dissertation
2022-07-06 00:09:50
<strong>dissertation editing help https://dissertationwritingcenter.com/</strong>
dissertation crossword clue
2022-07-06 02:43:06
<strong>writing your dissertation in a week https://dissertationhelpexpert.com/</strong>
writing a dissertation abstract
2022-07-06 05:09:53
<strong>dissertation help leicester https://accountingdissertationhelp.com/</strong>
dissertation writing uk
2022-07-06 09:27:45
<strong>dissertation presentation https://writing-a-dissertation.net/</strong>
writing a doctoral dissertation
2022-07-06 11:30:05
<strong>dissertation title generator https://bestdissertationwritingservice.net/</strong>
dissertation acknowledgement sample
2022-07-06 14:58:08
<strong>dissertation help online https://businessdissertationhelp.com/</strong>
undergraduate dissertation
2022-07-06 16:47:46
<strong>dissertation writing plan https://customdissertationwritinghelp.com/</strong>
art dissertation help
2022-07-07 01:51:32
<strong>dissertation vs thesis https://dissertationhelperhub.com/</strong>
greektown online casino
2022-07-25 18:40:40
<strong>online casino suomi https://download-casino-slots.com/</strong>
free casino slots online
2022-07-25 22:29:08
<strong>online casino real money https://firstonlinecasino.org/</strong>
online casino websites
2022-07-26 01:07:38
<strong>playnet online casino https://onlinecasinofortunes.com/</strong>
four winds online casino app
2022-07-26 03:08:35
<strong>borgata online casino nj https://newlasvegascasinos.com/</strong>
online casino no deposit
2022-07-26 05:40:49
<strong>resorts online casino bonus codes https://trust-online-casino.com/</strong>
borgata pa online casino
2022-07-26 06:29:33
<strong>mount airy online casino https://onlinecasinosdirectory.org/</strong>
four winds online casino
2022-07-26 09:42:43
<strong>casino online com https://9lineslotscasino.com/</strong>
best payout online casino
2022-07-26 12:47:34
<strong>casino online dinero real usa https://free-online-casinos.net/</strong>
empire casino online
2022-07-26 16:11:51
<strong>slot casino online https://internet-casinos-online.net/</strong>
online casino colorado
2022-07-26 18:35:20
<strong>online casino https://cybertimeonlinecasino.com/</strong>
michigan casino online
2022-07-26 19:09:11
<strong>rsweeps riversweeps online casino https://1freeslotscasino.com/</strong>
borgata pa online casino
2022-07-26 23:13:31
<strong>online casino free bonus https://vrgamescasino.com/</strong>
online keno casino
2022-07-27 01:40:00
<strong>online casino for us players https://casino-online-roulette.com/</strong>
sugarhouse casino online sportsbook
2022-07-27 04:10:57
<strong>online real money casino https://casino-online-jackpot.com/</strong>
betmgm online casino michigan
2022-07-27 06:32:47
<strong>online casino big winners https://onlineplayerscasino.com/</strong>
pala casino online
2022-07-27 10:56:46
<strong>pa online casino sign up bonus https://ownonlinecasino.com/</strong>
online casino for real money no deposit
2022-07-27 11:49:49
<strong>new pa online casino https://all-online-casino-games.com/</strong>
online casino spiele
2022-07-27 15:55:47
<strong>online casino gaming https://casino8online.com/</strong>
pia vpn download
2022-08-07 14:21:58
<strong>free vpn mac https://freevpnconnection.com/</strong>
vpn to change location free
2022-08-07 16:37:21
<strong>cyberghost vpn free trial https://shiva-vpn.com/</strong>
how does vpn work
2022-08-07 20:58:58
<strong>best vpn service lifehacker https://freehostingvpn.com/</strong>
open vpn
2022-08-07 21:55:22
<strong>ultrasurf vpn https://ippowervpn.net/</strong>
avast vpn reviews
2022-08-08 02:48:29
<strong>chrome vpn https://superfreevpn.net/</strong>
best vpn for mac free
2022-08-08 04:33:09
<strong>best free vpn for mac https://free-vpn-proxy.com/</strong>
vpn ip address free
2022-08-08 08:11:57
<strong>best free vpn https://rsvpnorthvalley.com/</strong>
gay dating for hung
2022-08-23 14:05:49
<strong>xxx dating sim gay https://gay-singles-dating.com/</strong>
adam4adamn gay dating
2022-08-23 16:45:40
<strong>dating advice for gay men https://gayedating.com/</strong>
senior gay women dating
2022-08-23 18:22:04
<strong>gay dating a macho https://datinggayservices.com/</strong>
meetme dating site
2022-08-24 13:30:42
<strong>dating near me free https://freephotodating.com/</strong>
online dating plus 50
2022-08-24 14:32:36
<strong>free daing https://onlinedatingbabes.com/</strong>
single dating
2022-08-24 18:29:43
<strong>free dating sites for men https://adult-singles-online-dating.com/</strong>
adult singles
2022-08-24 19:41:32
<strong>fdating international https://adult-classifieds-online-dating.com/</strong>
dating sites without registering
2022-08-25 01:01:18
<strong>meet single women online https://speedatingwebsites.com/</strong>
bdsm dating
2022-08-25 02:51:51
<strong>free sex chat sites https://datingpersonalsonline.com/</strong>
women for free
2022-08-25 05:11:29
<strong>free online chat https://wowdatingsites.com/</strong>
online dating match
2022-08-25 08:58:38
<strong>top online dating websites https://freeadultdatingpasses.com/</strong>
absolutely free dating sites
2022-08-25 11:14:39
<strong>dating game https://virtual-online-dating-service.com/</strong>
dating match
2022-08-25 16:22:41
<strong>totally free dating sites no fees ever https://onlinedatingservicesecrets.com/</strong>
hardrock online casino nj
2022-08-30 10:44:48
<strong>online casino with free bonus without deposit https://onlinecasinos4me.com/</strong>
ruby fortune online casino
2022-08-30 16:09:57
<strong>free online casino tournaments https://online2casino.com/</strong>
best michigan online casino
2022-08-30 17:20:30
<strong>online casino with real money https://casinosonlinex.com/</strong>
gay chat rooms no registration
2022-09-03 02:02:04
<strong>profile tube boys user gay chat boi https://newgaychat.com/</strong>
free gay chat 803 area code
2022-09-03 04:24:31
<strong>free adult gay chat https://gaychatcams.net/</strong>
wisconsin gay chat
2022-09-03 10:59:47
<strong>transcript of a man's first gay chat https://gaychatspots.com/</strong>
gay cam chat
2022-09-03 16:23:36
<strong>totaly free gay chat https://gay-live-chat.net/</strong>
gay chat random alternative
2022-09-04 06:52:54
<strong>gay bdsm chat https://gaychatnorules.com/</strong>
free gay/bi-sex chat sites
2022-09-04 13:57:10
<strong>gay chat porn https://gaymusclechatrooms.com/</strong>
chat gay granada
2022-09-04 15:36:26
<strong>snap chat solo gay school boy https://free-gay-sex-chat.com/</strong>
chat de gay usa
2022-09-04 22:25:20
<strong>chat gay https://gayinteracialchat.com/</strong>
gay boy teen boys webcam chat rooms
2022-10-20 17:10:31
<strong>in gay chat what is an otter? https://gaymanchatrooms.com/</strong>
custom papers writing
2022-10-20 18:32:39
<strong>custom papers for college https://term-paper-help.org/</strong>
write my math paper
2022-10-20 20:06:51
<strong>buy a paper https://sociologypapershelp.com/</strong>
buy college papers online
2022-10-20 20:55:31
<strong>custom paper writing https://uktermpaperwriters.com/</strong>
professional paper writing services
2022-10-20 23:48:25
<strong>do my paper for money https://writepapersformoney.com/</strong>
academic paper writers
2022-10-21 00:59:09
<strong>custom papers online https://write-my-paper-for-me.org/</strong>
best online paper writing service
2022-10-21 03:56:05
<strong>help writing papers https://top100custompapernapkins.com/</strong>
write my math paper
2022-10-21 05:35:48
<strong>write my paper for money https://researchpaperswriting.org/</strong>
help with writing a paper
2022-10-21 06:20:44
<strong>paper writing service https://cheapcustompaper.org/</strong>
write my paper for me in 3 hours
2022-10-21 08:13:12
<strong>someone write my paper https://writingpaperservice.net/</strong>
dltk custom writing paper
2022-10-21 08:56:06
<strong>scientific paper writing services https://buyessaypaperz.com/</strong>
help writing a college paper
2022-10-21 10:28:58
<strong>write my paper apa format https://mypaperwritinghelp.com/</strong>
paper writing website
2022-10-21 11:47:33
<strong>custom paper writers https://writemypaperquick.com/</strong>
paper writing services online
2022-10-21 12:58:24
<strong>will you write my paper for me https://essaybuypaper.com/</strong>
write my custom paper
2022-10-21 14:15:29
<strong>buying college papers https://papercranewritingservices.com/</strong>
pay someone to write paper
2022-10-21 16:17:50
<strong>best write my paper website https://premiumpapershelp.com/</strong>
3stagnant
2023-01-26 05:40:08
<strong>2opprobrium</strong>
do my coursework
2023-02-05 14:59:13
<strong>coursework research https://brainycoursework.com/</strong>
coursework project
2023-02-05 18:57:00
<strong>help with coursework https://mycourseworkhelp.net/</strong>
coursework writing service
2023-02-05 20:40:31
<strong>design technology coursework https://courseworkdownloads.com/</strong>
coursework writers
2023-02-06 00:23:06
<strong>do my coursework https://teachingcoursework.com/</strong>
coursework help uk
2023-02-06 01:49:27
<strong>coursework moderation https://buycoursework.org/</strong>
free personals
2023-02-08 13:25:20
<strong>gay free https://freewebdating.net/</strong>
online dating women
2023-02-08 14:02:55
<strong>top single service https://jewish-dating-online.net/</strong>
n dating site
2023-02-08 15:11:38
<strong>personal dating ads https://jewish-dating-online.net/</strong>
sabrina carpenter boyfriend
2023-02-08 16:18:35
<strong>plentyoffish login https://free-dating-sites-free-personals.com/</strong>
dating personal ads
2023-02-08 20:17:52
<strong>ourtime logga in https://onlinedatingsuccessguide.com/</strong>
website dating service
2023-02-08 20:54:00
<strong>dating flirt site free https://onlinedatinghunks.com/</strong>
zoosk dating login
2023-02-08 23:08:11
<strong>professional dating sites https://datingwebsiteshopper.com/</strong>
pof login canada
2023-02-09 00:28:39
<strong>dating website no credit card https://allaboutdatingsites.com/</strong>
dating websites best
2023-02-09 00:56:26
<strong>dating usa https://freedatinglive.com/</strong>
personal ads dating
2023-02-09 02:44:34
<strong>meet european singles in usa https://freewebdating.net/</strong>
Яндекс.Метрика