Docker安装prometheus

# 拉取镜像
docker pull prom/prometheus:v2.22.0

# 创建配置文件
mkdir -p /opt/prometheus/
cd /opt/prometheus
vim prometheus.yml

global:
  scrape_interval:     60s
  evaluation_interval: 60s
 
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
        labels:
          instance: prometheus
# 运行容器
docker run -d --name prometheus -p 9090:9090 -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:v2.22.0

浏览器访问:http://宿主机ip:9090

posted @ 2020-10-19 14:29  哈喽哈喽111111  阅读(1396)  评论(0编辑  收藏  举报