溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

prometheus07-alertmanager報(bào)警

發(fā)布時(shí)間:2020-07-02 17:53:55 來源:網(wǎng)絡(luò) 閱讀:471 作者:小小三郎1 欄目:系統(tǒng)運(yùn)維

https://prometheus.io/download/



1.原理圖

prometheus07-alertmanager報(bào)警

2.安裝

tar?xf?alertmanager-0.19.0.linux-amd64.tar.gz???-C??/usr/local/alertmanager
cd???/usr/local/alertmanager

修改配置:
[root@zabbix-proxy?alertmanager]#?cat?alertmanager.yml?
global:
??resolve_timeout:?5m
??smtp_smarthost:?'smtp.163.com:25'
??smtp_from:?'ww673004768@163.com'
??smtp_auth_username:?'ww673004768@163.com'
??smtp_auth_password:?'123456'
??smtp_require_tls:?false
route:
??group_by:?['alertname']
??group_wait:?10s
??group_interval:?10s
??repeat_interval:?1h
??receiver:?'email'
receivers:
-?name:?'email'
??email_configs:
??-?to:?'w673004768@163.com'
inhibit_rules:
??-?source_match:
??????severity:?'critical'
????target_match:
??????severity:?'warning'
????equal:?['alertname',?'dev',?'instance']
[root@zabbix-proxy?alertmanager]#?

校驗(yàn)配置:
[root@zabbix-proxy?alertmanager]#?./amtool?check-config?./alertmanager.yml?
Checking?'./alertmanager.yml'??SUCCESS
Found:
?-?global?config
?-?route
?-?1?inhibit?rules
?-?1?receivers
?-?0?templates
[root@zabbix-proxy?alertmanager]#?pwd
/usr/local/alertmanager
[root@zabbix-proxy?alertmanager]#

3.systemd管理 alertmanager

[root@zabbix-proxy?alertmanager]#?cat?/usr/lib/systemd/system/alertmanager.service?
[Unit]?
Description=Alertmanager?
After=network.target?
[Service]?
Type=simple?
User=root
ExecStart=/usr/local/alertmanager/alertmanager?--config.file=/usr/local/alertmanager/alertmanager.yml?--storage.path=/usr/local/alertmanager/data
Restart=on-failure
[Install]?
WantedBy=multi-user.target
You?have?new?mail?in?/var/spool/mail/root
[root@zabbix-proxy?alertmanager]#

4.設(shè)置prometheus的配置

vim? prometheus.yml

prometheus07-alertmanager報(bào)警?./promtool? ?check? config? prometheus.yml? 校驗(yàn)配置文件 并重啟


5.查看報(bào)警配置rule

[root@zabbix-proxy?rules]#?cat?general.yml?
groups:
-?name:?general
??rules:
??-?alert:?InstanceDown
????expr:?up?==?0
????for:?1m?
????labels:
??????severity:?error
????annotations:
??????summary:?"Instance?{{?$labels.instance?}}?down"?
??????description:?"{{?$labels.instance?}}?of?job?{{?$labels.job?}}?has?been?down?for?more?than?1?minutes."?
[root@zabbix-proxy?rules]#?pwd
/usr/local/prometheus/rules
[root@zabbix-proxy?rules]#


6.測試

prometheus07-alertmanager報(bào)警

prometheus07-alertmanager報(bào)警

prometheus07-alertmanager報(bào)警

prometheus07-alertmanager報(bào)警

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI