docker安装prometheus

系统:Centos7

docker pull prom/prometheus
ifconfig | grep -A 1 docker0
mkdir -p /home/prometheus
vi /home/prometheus/prometheus.yml

配置文件写入一下内容(targets对应服务器所在的地址)

global:
  scrape_interval:     60s
  evaluation_interval: 60s
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['172.17.0.1:9090']
        labels:
          instance: prometheus
  - job_name: linux
    static_configs:
      - targets: ['10.100.1.15:9100']
  - job_name: mysql
    static_configs:
      - targets: ['172.17.0.1:9104']

创建容器,设置自启动

docker run -itd --name prometheus -p 9090:9090 --restart=always -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /etc/localtime:/etc/localtime:ro prom/prometheus

启动后访问 http://服务器地址:9090


标签:暂无标签
版权属于:瑶玲OvO 所有,转载请注明文章来源。

本文链接: https://www.linmy.cn/index.php/prometheus/57.html

赞 (0)

评论区

发表评论

字数
0
/200
18+47=?

暂无评论,要不来一发?

回到顶部