prometheus07-alertmanager报警-创新互联
https://prometheus.io/download/
目前创新互联公司已为上千家的企业提供了网站建设、域名、虚拟空间、网站托管、服务器租用、企业网站设计、鄂州网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。1.原理图
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]# 校验配置: [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.设置prometheus的配置
vim prometheus.yml
./promtool check config prometheus.yml 校验配置文件 并重启
5.查看报警配置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.测试
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
标题名称:prometheus07-alertmanager报警-创新互联
标题链接:http://myzitong.com/article/ddseoi.html