In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Prometheus (Prometheus) build monitoring in my last blog, if you need to refer to, the second part of this article, the first article is Prometheus (Prometheus) set up monitoring, two articles can be read together
Warm reminder, please replace the mailboxes involved in the following documents with your own. Thank you, otherwise you will not receive the alarm message, it will be sent to me.
1) deploy prometheus monitoring component alertmanager.
[root@docker01 ~] # docker load
< alertmanager.tar [root@docker01 ~]# docker run -d --name alertmanager -p 9093:9093 prom/alertmanager [root@docker01 ~]# vim alertmanager.yml global: resolve_timeout: 5m smtp_from: '2389113325@qq.com' smtp_smarthost: 'smtp.qq.com:465' smtp_auth_username: '2389113325@qq.com' smtp_auth_password: 'ikeamxidxbodeaba' smtp_require_tls: false smtp_hello: 'qq.com' route: group_by: ['alertname'] group_wait: 5s group_interval: 5s repeat_interval: 5m receiver: 'email' receivers: name: 'email' email_configs:to: '2389113325@qq.com' send_resolved: true inhibit_rules:source_match: severity: 'critical' target_match: severity: 'warning' equal: ['alertname', 'dev', 'instance'] [root@docker01 ~]# docker rm -f alertmanager [root@docker01 ~]# docker run -d --name alertmanager -p 9093:9093 -v /root/alertmanager.yml:/etc/alertmanager/alertmanager.yml prom/alertmanager 2)创建监控规则,使用email报警方式。监控服务运行状态,如果服务节点down机状态,则发送邮件。 [root@docker01 ~]# mkdir -p prometheus/rules [root@docker01 ~]# cd prometheus/rules/ [root@docker01 ~]# vim prometheus.yml 12行:Line 12:
Targets:192.168.1.10:9093
Line 15:
"/ usr/local/prometheus/rules/*.rules"
[root@docker01] # docker rm-f prometheus
[root@docker01] # docker run-d-p 9090 name prometheus-- net=host-v / root/prometheus.yml:/etc/prometheus/prometheus.yml-v / root/prometheus/rules/node-up.rules:/usr/local/prometheus/rules/node-up.rules prom/prometheus
Docker02:
[root@docker02 ~] # docker stop cadvisor
Cadvisor
3) create an email sending template, still use email alarm method, simulate the downmachine status of the service node, and view and verify the email sending template.
[root@docker01 ~] # cd prometheus/
[root@docker01 prometheus] # mkdir alertmanager-tmpl
[root@docker01 prometheus] # cd alertmanager-tmpl/
[root@docker01 alertmanager-tmpl] # vim email.tmpl
{{define "email.from"}} 2389113325@qq.com {{end}}
{{define "email.to"}} 2389113325@qq.com {{end}}
{{define "email.to.html"}}
{{range .Alerts}}
= start=
Alarm program: prometheus_alert
Alarm level: {{.Labels.alarm}} level
Alarm type: {{.Labels.alertname}}
Failed host: {{.Labels.instance}}
Alarm topic: {{.Annotations.summary}}
Trigger time: {{.StartsAt.Format "2019-08-04 16:58:15"}}
= end=
{{end}}
{{end}}
[root@docker01 ~] # vim alertmanager.yml
Line 8:
Templates:
'/ etc/alertmanager-tmpl/*.tmpl'
Line 21:
Line 21: to:'{{template "email.to"}}'
Html:'{{template "email.to.html".}}'
[root@docker01] # docker rm-f alertmanager
[root@docker01] # docker run-itd-- name alertmanager- p 9093 itd 9093-v / root/alertmanager.yml:/etc/alertmanager/alertmanager.yml-v / root/prometheus/alertmanager-tmpl:/etc/alertmanager-tmpl prom/alertmanager:latest
Docker02:
[root@docker02 ~] # docker stop cadvisor
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Http://www.cnblogs.com/Warmsunshine/archive/2012/04/02/2430528.html
© 2024 shulou.com SLNews company. All rights reserved.