欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

如何解析MySQLprometheus郵件報警配置-創(chuàng)新互聯(lián)

這篇文章給大家介紹prometheus如何配置MySQL郵件報警,內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。

創(chuàng)新互聯(lián)技術(shù)團(tuán)隊十多年來致力于為客戶提供成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計、成都品牌網(wǎng)站建設(shè)網(wǎng)絡(luò)營銷推廣、搜索引擎SEO優(yōu)化等服務(wù)。經(jīng)過多年發(fā)展,公司擁有經(jīng)驗豐富的技術(shù)團(tuán)隊,先后服務(wù)、推廣了上千家網(wǎng)站,包括各類中小企業(yè)、企事單位、高校等機(jī)構(gòu)單位。

這里介紹一下prometheus的郵件報警配置。

alertmanager下載

prometheus報警配置需要用到alertmanager組件,這個組件可以到prometheus官網(wǎng)上進(jìn)行下載。

https://prometheus.io/download/

如何解析MySQL prometheus郵件報警配置

由于最新版本的alertmanager組件配置郵箱通訊存在一些問題,我們這里選擇在github上下載0.14版本的alertmanager。

https://github.com/prometheus/alertmanager

如何解析MySQL prometheus郵件報警配置

附具體下載地址:

https://github.com/prometheus/alertmanager/releases/download/v0.14.0/alertmanager-0.14.0.linux-amd64.tar.gz

alertmanager安裝配置

將下載的alertmanager包進(jìn)行解壓安裝。

tar -xf alertmanager-0.14.0.linux-amd64.tar.gz
mv alertmanager-0.14.0.linux-amd64 /data/alertmanager

編輯alertmanager的配置文件,添加郵箱信息。

# cd /data/alertmanager
# cat alertmanager.yml
global:
  smtp_smarthost: smtp.exmail.xxx.com:465 # 發(fā)件人郵箱smtp地址
  smtp_auth_username: xxxx@xxx.com # 發(fā)件人郵箱賬號
  smtp_from: xxx@xxx.com # 發(fā)件人郵箱賬號
  smtp_auth_password: xxxxxx # 發(fā)件人郵箱密碼
  resolve_timeout: 5m
  smtp_require_tls: false
route:
  # group_by: ['alertname'] # 報警分組依據(jù)
  group_wait: 10s # 最初即第一次等待多久時間發(fā)送一組警報的通知
  group_interval: 10s # 在發(fā)送新警報前的等待時間
  repeat_interval: 1m # 發(fā)送重復(fù)警報的周期 對于email配置中多頻繁
  receiver: 'email'
receivers:
- name: email
  email_configs:
  - send_resolved: true
    to: xxx@xxx.com # 收件人郵箱賬號

啟動alertmanager。

# cd /data/alertmanager
./alertmanager --config.file=alertmanager.yml &

alertmanager的默認(rèn)端口為9093。

如何解析MySQL prometheus郵件報警配置

prometheus配置

在prometheus目錄下編輯報警模版alert_rules.yml,添加一些自定義報警項。

# cd /data/prometheus
# cat alert_rules.yml
groups:
- name: MySQL-rules
  rules:
  - alert: MySQL Status # 告警名稱
    expr: up == 0
    for: 5s # 滿足告警條件持續(xù)時間多久后,才會發(fā)送告警
    annotations: # 解析項,詳細(xì)解釋告警信息
      summary: "{{$labels.instance}}: MySQL has stop !!!"
      value: "{{$value}}"
      alertname: "MySQL數(shù)據(jù)庫停止運(yùn)行"
      description: "檢測MySQL數(shù)據(jù)庫運(yùn)行狀態(tài)"
      message: 當(dāng)前數(shù)據(jù)庫實(shí)例{{$labels.instance}}已經(jīng)停止運(yùn)行,請及時處理
  - alert: MySQL Slave IO Thread Status # 告警名稱
    expr: mysql_slave_status_slave_io_running == 0
    for: 5s # 滿足告警條件持續(xù)時間多久后,才會發(fā)送告警
    annotations: # 解析項,詳細(xì)解釋告警信息
      summary: "{{$labels.instance}}: MySQL Slave IO Thread has stop !!!"
      value: "{{$value}}"
      alertname: "MySQL主從IO線程停止運(yùn)行"
      description: "檢測MySQL主從IO線程運(yùn)行狀態(tài)"
      message: 當(dāng)前數(shù)據(jù)庫實(shí)例{{$labels.instance}} IO線程已經(jīng)停止運(yùn)行,請及時處理
  - alert: MySQL Slave SQL Thread Status # 告警名稱
    expr: mysql_slave_status_slave_sql_running == 0
    for: 5s # 滿足告警條件持續(xù)時間多久后,才會發(fā)送告警
    annotations: # 解析項,詳細(xì)解釋告警信息
      summary: "{{$labels.instance}}: MySQL Slave SQL Thread has stop !!!"
      value: "{{$value}}"
      alertname: "MySQL主從SQL線程停止運(yùn)行"
      description: "檢測MySQL主從SQL線程運(yùn)行狀態(tài)"
      message: 當(dāng)前數(shù)據(jù)庫實(shí)例{{$labels.instance}} SQL線程已經(jīng)停止運(yùn)行,請及時處理
  - alert: MySQL Slave Delay Status # 告警名稱
    expr: mysql_slave_status_sql_delay == 30
    for: 5s # 滿足告警條件持續(xù)時間多久后,才會發(fā)送告警
    annotations: # 解析項,詳細(xì)解釋告警信息
      summary: "{{$labels.instance}}: MySQL Slave Delay has more than 30s !!!"
      value: "{{$value}}"
      alertname: "MySQL主從延時過大"
      description: "檢測MySQL主從延時狀態(tài)"
      message: 當(dāng)前數(shù)據(jù)庫實(shí)例{{$labels.instance}} 主從延時狀態(tài)已經(jīng)超過30s,請及時處理

在prometheus目錄下編輯prometheus的配置文件,將監(jiān)控的配置信息添加到prometheus.yml。

# cd /data/prometheus
# cat prometheus.yml
# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - 172.18.0.24:9093 # 對應(yīng)啟動的altermanager節(jié)點(diǎn)的9093端口
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - "alert_rules.yml" # 對應(yīng)前面編輯的報警模版alert_rules.yml文件
# A scrape configuration containing exactly one endpoint to scrape:
scrape_configs:
  - file_sd_configs:
    - files:
      - mysql.yml
    job_name: MySQL
    metrics_path: /metrics
    relabel_configs:
    - source_labels: [__address__]
      regex: (.*)
      target_label: __address__
      replacement: $1

編輯完成后,重新加載一下配置更改。

kill -HUP [prometheus PID]

驗證郵件報警

登陸prometheus的web頁面,查看報警信息。

瀏覽器輸入Prometheus_IP:9090 ,可以看到各個報警項的狀態(tài)。

如何解析MySQL prometheus郵件報警配置

停掉主從線程,模擬觸發(fā)報警。

如何解析MySQL prometheus郵件報警配置

Slave SQL線程停掉后,報警項顏色變成黃色,持續(xù)時間超過定義的持續(xù)時間后,顏色變紅,并發(fā)送郵件。

如何解析MySQL prometheus郵件報警配置

如何解析MySQL prometheus郵件報警配置

收到報警郵件。

如何解析MySQL prometheus郵件報警配置

如何解析MySQL prometheus郵件報警配置

關(guān)于prometheus如何配置MySQL郵件報警就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

當(dāng)前題目:如何解析MySQLprometheus郵件報警配置-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://aaarwkj.com/article26/gdccg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、動態(tài)網(wǎng)站、用戶體驗、云服務(wù)器搜索引擎優(yōu)化、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營
欧美另类亚洲日本一区二区| 亚洲精品色播一区二区| 最近中文字幕免费手机版| 人妻操人人妻中出av| 99热在线精品国产观看| 亚洲福利一区福利三区| 成人午夜激情在线观看| 激情综合色综合久久丁香| 俩小伙探花专约老熟女| 久久综合久中文字幕青草| 亚洲精品在线观看午夜福利| 国产精品久久久久精品三级下载 | 欧美日韩专区一区二区三区 | 久久亚洲女同第一区综合| 成人免费毛片1000部| 在线看黄色片播放器日韩| 欧美精品国产精品久久| 麻豆国产国语精品三级在线观看| 少妇精品久久久一区二区三区| 少妇激情一区二区三区免费视频| 国产三级三级三级免费看| 国产精品一区二区三区播放| 欧美特黄在线免费观看| av在线高清免费观看| 亚洲综合实力最强的国家| 日本韩国欧美在线一区| 国产高清剧情av网站| 成人免费激情在线观看| 精品亚洲综合一区二区| 歪歪私人影院午夜毛片| 18禁免费无遮挡免费视频| 国产夫妻性生活视频播放| 亚洲丰满性感美女av| 日本电影在线看一区二区| 亚洲高清精品一区二区| 国产福利成人一区二区| 青青草青娱乐免费在线视频| 91精品亚洲内射孕妇| 国产三级黄色片免费看| 亚洲欧美综合一区二区三区| 日本韩国三级理伦久久久|