docker 版本prometheus

缘由

之前是jar 安装到服务器,但是服务器重启后,没有自启动,而且很多都是docker维护,有平台方便重启,

最后还是决定docker 安装prometheus

 

安装

1
docker run -itd --name=prometheus --restart=always -p 9090:9090 prom/prometheus

  

容器创建成功后,即可通过浏览器访问 http: / /{ip}:9090  来进行验证

 

配置

复制docker内配置文件出来

docker cp prometheus:/etc/prometheus/prometheus.yml $PWD
复制代码
[root@Docker ~]# vim prometheus.yml
在Prometheus配置文件按以下内容修改:
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']
      labels:
        instance: prometheus

  - job_name: linux
    static_configs:
    - targets: ['192.168.1.1:9100']         #被监控端的IP地址和端口号(有多个被监控端可用 逗号 隔开)
      labels:
        instance: localhost
复制代码

修改后 复制回去

docker cp $PWD/prometheus.yml prometheus:/etc/prometheus/prometheus.yml

 最后重启prometheus

 

 

 

posted @   AlamZ  阅读(19)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2017-07-16 python 时间复杂度
点击右上角即可分享
微信分享提示