首页 > 其他 > 详细

我用 docker 部署 prometheus

时间:2020-05-19 09:42:28      阅读:240      评论:0      收藏:0      [点我收藏+]
安装 Master

首先把所以机器名配置在 /etc/hosts 文件中。

配置文件/etc/prometheus/prometheus.yml 内容如下:

global:
  scrape_interval:     15s
  evaluation_interval: 15s

alerting:
  alertmanagers:
  - static_configs:
    - targets:

rule_files:

scrape_configs:
  - job_name: ‘prometheus‘
    static_configs:
      - targets: [‘localhost:9090‘]
  - job_name: ‘node_export‘
    static_configs:
      - targets:
        - server1:9100
        - server2:9100

启动命令

docker run   --name prometheus   -d -p 9090:9090   -v /etc/hosts:/etc/hosts   -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml   prom/prometheus   --web.read-timeout=5m   --config.file=/etc/prometheus/prometheus.yml   --storage.tsdb.path=/prometheus   --web.max-connections=512   --storage.tsdb.retention=30d   --query.timeout=2m

安装 Grafana

docker run --name grafana -d -p 3000:3000 grafana/grafana

初始登陆账号密码都是 admin

可以使用模版ID:10180

安装 node_export

sudo wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz;
sudo tar xvfz node_exporter-0.18.1.linux-amd64.tar.gz;
mv node_exporter-0.18.1.linux-amd64/node_exporter /usr/local/bin/
node_exporter &

或者使用 docker

docker run -d   --net="host"   --pid="host"   -v "/:/host:ro,rslave"   quay.io/prometheus/node-exporter   --path.rootfs=/host

欢迎大家扫码关注,获取更多信息

技术分享图片

我用 docker 部署 prometheus

原文:https://blog.51cto.com/wzlinux/2496276

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!