亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

prometheus之docker監控與告警系列(二)

標簽:
Docker

本系列主要介绍prometheus+cadvisor+alertmanager打造docker监控,主要监控指定docker容器是否挂掉

本节主要熟悉prometheus+Alertmanager的部署和基本使用

一、说明

prometheus本身并没有集成告警功能,需要配合Alertmanager使用

二、下载并安装Alertmanager

进入下载页,操作系统选择darwin

https://prometheus.io/download/

往下拉,看到alertmanager

webp

alertmanager.png

三、配置Prometheus,使其可以与Alertmanager通信

# Alertmanager配置alerting:
 alertmanagers:
 - static_configs:
   - targets: ["localhost:9093"] # 设定alertmanager和prometheus交互的接口,即alertmanager监听的ip地址和端口

四、添加prometheus.rules.yml,配置Prometheus规则,实例down掉触发alert

groups:
- name: Instances
  rules:
  - alert: InstanceDown
    expr: up == 0    for: 5s
    labels:
      severity: page    # Prometheus templates apply here in the annotation and label fields of the alert.
    annotations:
      description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 s.'
      summary: 'Instance {{ $labels.instance }} down'

为prometheus指定规则文件

rule_files:
  - 'prometheus.rules.yml'

五、编辑alertmanager.yml,配置webhook_config,即告警触发的接口调用

global:
  resolve_timeout: 5m

route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'web.hook'receivers:
- name: 'web.hook'
  webhook_configs:
  - url: 'http://localhost:5200/auth/instanceDown'
  •   是你的告警会触发的接口调用



作者:2远
链接:https://www.jianshu.com/p/2305526bdfdd


點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消