Prometheus+Grafana快速部署

容器2周前更新 hank
104 0
所需镜像
prometheus+grafana+note_exporter
使用docker-compose部署prometheus+grafana+note_exporter
这里的镜像是我自己的镜像仓库,标签不是真实的,latest
docker pull uhub.service.ucloud.cn/jiankong/grafana:latest
docker pull uhub.service.ucloud.cn/jiankong/prometheus:latest
docker pull uhub.service.ucloud.cn/jiankong/node-exporter:latest
附:
github开源项目 prometheus+node_exporter+alertmanager
docker run –name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
docker run –name alertmanager -d -p 127.0.0.1:9093:9093 quay.io/prometheus/alertmanager
docker run -d \
–net=”host” \
–pid=”host” \
-v “/:/host:ro,rslave” \
quay.io/prometheus/node-exporter:latest \
–path.rootfs=/host
docker run -d -p 3000:3000 –name=grafana grafana/grafana-enterprise
#docker-compose.yml
version: '3.8'

services:
  prometheus:
    image: uhub.service.ucloud.cn/jiankong/prometheus:latest
    container_name: prometheus
    volumes:
      - ./config/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
    restart: unless-stopped

  node-exporter:
    image: uhub.service.ucloud.cn/jiankong/node-exporter:latest
    container_name: node-exporter
    ports:
      - "9100:9100"
    restart: unless-stopped

  grafana:
    image: uhub.service.ucloud.cn/jiankong/grafana:latest
    container_name: grafana
    ports:
      - "3000:3000"
    restart: unless-stopped
    volumes:
      - grafana-storage:/var/lib/grafana

volumes:
  grafana-storage:
/root/jiankong/config/prometheus.yml
./config/prometheus.yml
#prometheus.yml
global:
  scrape_interval: 15s
scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'node-exporter'
    static_configs:
      - targets: ['node-exporter:9100']
在docker-compose.yml存在的路径下运行docker-compose up -dPrometheus+Grafana快速部署
访问IP:端口
进入grafana: ip:3000
初始账号是admin:admin
然后会提示修改密码
Prometheus+Grafana快速部署
选择connections->date sources 添加普罗米修斯
Prometheus+Grafana快速部署
Prometheus+Grafana快速部署设置
Name prometheus
->
Connection
->
Prometheus+Grafana快速部署
Interval behaviour
–Scrape interval
Prometheus+Grafana快速部署
Prometheus+Grafana快速部署
接下来需要使用dashboard仪表板,这里可以蹭蹭别人的,也可以自行去自定义一个
Prometheus+Grafana快速部署
选择一款后,去获取他的ID
Prometheus+Grafana快速部署
去导入这个仪表板
Prometheus+Grafana快速部署
自行修改名字->选择 date source
->import
Prometheus+Grafana快速部署
效果展示:
Prometheus+Grafana快速部署
© 版权声明

相关文章