1,拉取镜像

docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana

2,

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

3,

mkdir /opt/prometheus
cd /opt/prometheus/vim 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: ['192.168.91.132:9100']
        labels:
          instance: localhost
docker run  -d \  -p 9090:9090 \  -v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml  \
  prom/prometheus

4,

mkdir /opt/grafana-storage
chmod 777 -R /opt/grafana-storage
docker run -d \ -p 3000:3000 \ --name=grafana \ -v /opt/grafana-storage:/var/lib/grafana \ grafana/grafana

5,访问:http://ip:3000/ (用户名/密码:admin/admin)

Add data source

 import(地址:Grafana Plugins - extend and customize your Grafana | Grafana Labs

 

posted on 2023-07-26 20:36  song.yan  阅读(59)  评论(0编辑  收藏  举报