In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article uses an example to show the method of configuring prometheus and alertmanager communication to trigger alarm, the code is very detailed, which can be used as a reference for interested friends. I hope it will be helpful to you.
Alertmanager and Prometheus are two separate components. The Prometheus server sends the alarm to Alertmanager according to the alarm rules, and then Alertmanager sends messages such as silencing, inhibition, aggregation, etc., via email, Wechat, etc.
Install and deploy alertmanager
Download the software package
Wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz
Decompression and installation
Tar zxvf alertmanager-0.16.0.linux-amd64.tar.gz & & cd alertmanager-0.16.0.linux-amd64
Start alertmanager
. / alertmanager-- config.file=alertmanager.yml
Configure prometheus to communicate with alertmanager
Modify prometheus.yml configuration file
Configure communication with alertmanager
Alerting: alertmanagers:-static_configs:-targets:-x.x.x.x:9093
Add alarm rules to monitor host service. Default is 1.
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
Rule_files:
"rules/*.yml" groups:- name: generals.rules rules:-alert: InstanceDown expr: up = = 0 for: 1m labels: severity: error annotations: summary: "Instance {{$labels.isinstance}} down" description: "{{$labels.instance}} down more than 1 minutes"
Reload the configuration file kill-hup $pid or restart the prometheus service
View configured alarm rules
Trigger alarm
Alarm rule has been created, set email notification alarm, QQ Mail has been shown, QQ Mail needs to enable smtp
Smtp_require_tls defaults to true, which needs to be changed to false, otherwise the email is triggered unsuccessfully. Enter the authorization horse for smtp_auth_password.
Global: global configuration, including timeout after alarm resolution, SMTP related configuration, API address of various channel notifications, and so on.
Route: used to set the alarm distribution policy, which is a tree structure that matches in depth-first order from left to right.
Receivers: configure alarm message recipient information, such as email, wechat, slack, webhook and other message notification methods.
Global: resolve_timeout: 5m smtp_smarthost: 'smtp.qq.com:465' smtp_from:' xxx@qq.com' smtp_auth_username: 'xxx@qq.com' smtp_auth_password:' xxx' # smtp_auth_secret: false smtp_require_tls: false smtp_hello: 'qq.com'route: group_by: [' alertname'] group_wait: 10s group_interval: 10s repeat_interval: 1h receiver:' Mail'receivers:- name: 'mail' email_configs:-to:' xxx@qq.com' send_resolved: true
Trigger alarm, shut down manually, es service, receive email alarm a few minutes later
The above is the configuration of prometheus and alertmanager communication to achieve trigger alarm method introduction, detailed use of their own use to know the specific essentials. If you want to read more related articles, you are welcome to follow the industry information channel!
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
© 2024 shulou.com SLNews company. All rights reserved.