Docker运行Prometheus和Grafana

Docker运行Prometheus和Grafana

(金庆的专栏 2018.4)

Prometheus官网的运行示例是直接执行。
可以参照 https://www.katacoda.com/ 的教程用Docker运行Prometheus和Grafana.
搜索 Grafana 的教程,运行步骤如下:

编写 prometheus.yml

global:
  scrape_interval:     15s
  evaluation_interval: 15s
scrape_configs:
  - job_name: 'prometheus'

    static_configs:
      - targets: ['localhost:9090', 'localhost:9100']
        labels:
          group: 'prometheus'

localhost 好像不行,换成 127.0.0.1

运行 prometheus

docker run -d --net=host \
  -v /root/prometheus.yml:/etc/prometheus/prometheus.yml \
  --name prometheus-server \
  prom/prometheus

运行 Node Exporter

docker run -d -p 9100:9100 \
-v "/proc:/host/proc" \
-v "/sys:/host/sys" \
-v "/:/rootfs" \
--net="host" \
--name=prometheus \
quay.io/prometheus/node-exporter:v0.13.0 \
  -collector.procfs /host/proc \
  -collector.sysfs /host/sys \
  -collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

运行 Grafana

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

缺省用户: admin/admin

添加数据源,并导入仪表盘

Add Data Sources ->
Name: Prometheus
Type: Prometheus
URL: http://1.2.3.4:9090
Access: proxy
Save & Test…

Create Import ->
Grafana.com Dashboard: 22

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值