企业devops实现二、搭建监控系统prometheus+grafana,实现微信告警

准备一台服务器,做为监控主机
配置:
4核CPU、8G内存、200G存储

一、 安装docker

二 、安装docker-compose

三、 安装监控系统prometheus+grafana

vim docker-compose.yml

version: '3'

services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    hostname: prometheus
    restart: always
    volumes:
      - /data/prometheus/config:/etc/prometheus
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/etc/prometheus/console_libraries'
      - '--web.console.templates=/etc/prometheus/consoles'
      - '--storage.tsdb.retention.time=200h'
      - '--web.enable-lifecycle'
    ports:
      - "9090:9090"
    networks:
      - monitor

  grafana:
    image: grafana/grafana
    container_name: grafana
    hostname: grafana
    restart: always
    volumes:
      - grafana_data:/var/lib/grafana
      - /data/grafana/provisioning:/etc/grafana/provisioning
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=password
      - GF_USERS_ALLOW_SIGN_UP=false  
    ports:
        - "3000:3000"
    networks:
      - monitor
  
networks:
  monitor:
    driver: bridge

volumes:
    prometheus_data:
    grafana_data:
posted @ 2022-03-18 11:13  zhang_xuebin  阅读(149)  评论(0)    收藏  举报