当前位置:网站首页>Alertmanager alarm configuration

Alertmanager alarm configuration

2022-06-12 02:24:00 oneslide

This example USES node_exporter The index item memory occupancy of is taken as an example , Record alertmanager How to configure Memory usage > 10% Alarm to Tencent corporate email .

docker-compose

version: '3.2'
services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
    - 9090:9090
    command:
    - --config.file=/etc/prometheus/prometheus.yml
    volumes:
    - ./prom/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    - ./prom/rule.yml:/etc/prometheus/rule.yml
  grafana:
    image: grafana/grafana-enterprise
    ports:
    - 3000:3000
  node_exporter:
    image: prom/node-exporter:latest
    container_name: node_exporter
    command:
      - '--path.rootfs=/host'
    network_mode: host
    pid: host
    restart: unless-stopped
    volumes:
      - '/:/host:ro,rslave'
  alertmanager:
    image: prom/alertmanager
    volumes:
    - ./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
    ports:
    - 9093:9093

prometheus To configure

  • prom/prometheus.yaml
#  Configuration file of alarm rules 
rule_files:
  - /etc/prometheus/rule.yml
# altermanager Service address of 
alerting:
  alertmanagers:
  - static_configs: 
    - targets:
      - alertmanager:9093
  • prom/rule.yml
groups:
- name: example
  rules:
  - alert: high_memory
    #  When the memory occupancy exceeds 10%, continued 1min, The alarm is triggered 
    expr: 100 - ((node_memory_MemAvailable_bytes{
    instance="192.168.10.64:9100",job="node_exporter"} * 100) / node_memory_MemTotal_bytes{
    instance="192.168.10.64:9100",job="node_exporter"}) > 90
    for: 1m
    labels:
      severity: page
    annotations:
      summary: spike memeory 

alertmanager To configure

  • alertmanager/alertmanager.yml

How to configure the password of Tencent enterprise mailbox , My article has a record - Jenkins send out email To Tencent corporate email Pipeline The way

global:
  # smtp Server address 
  smtp_smarthost: smtp.exmail.qq.com:465
  #  Sender email 
  smtp_from: <your_email>
  #  Sender email 
  smtp_auth_username: <your_email>
  #  Sender password 
  smtp_auth_password: <your_password>
  smtp_require_tls: false

route:
  group_by: ['alertname']
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 1h
  receiver: 'mail'
receivers:
  - name: 'mail'
    email_configs:
     #  Recipient email 
     - to: '<your_email>'
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']

原网站

版权声明
本文为[oneslide]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206120223262192.html