docker 部署prometheus和grafana

1.启动node 容器

docker run -d -p 9100:9100 -v "/proc:/host/proc:ro"  -v "/sys:/host/sys:ro"  -v "/:/rootfs:ro"  --net="bridge" prom/node-exporter

2.访问http://192.168.1.122:9100/metrics

3.创建文件/home/prometheus/ 下创建prometheus.yml

global:
  scrape_interval:     60s
  evaluation_interval: 60s
 
scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']
        labels:
          instance: prometheus
 
  - job_name: linux
    static_configs:
      - targets: ['修改docker服务器IP:9100']
        labels:
          instance: localhost
 

3.启动prometheus 容器

docker run  -d  -p 9090:9090  -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml   prom/prometheus

访问地址:http://192.168.1.122:9090/targets

4.创建文件夹,授权

/opt/grafana-storage
 chmod 777 -R /opt/grafana-storage

5.启动grafana 容器

docker run -d -p 3030:3000 --name=grafana -v /home/grafana/grafana-storage/:/var/lib/grafana  grafana/grafana

6.访问http://192.168.1.122:3030/

附: dashbord,可以下载对应 地址:Dashboards | Grafana Labs

你可能感兴趣的:(docker,容器,运维)