安装 Docker
安装 Grafana
安装 Prometheus
安装 Node Exporter
添加 Node
安装 Docker
curl -fsSL https://get.docker.com |bash
安装 Grafana
docker run -d --name=grafana -p 3000:3000 grafana/grafana
- 默认账号密码均为 admin
安装 prometheus
docker run -d --name prometheus -p 9090:9090 -v /root/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus --storage.tsdb.retention.time=14d
- 如果报错需要手动创建/root/prometheus/prometheus.yml
1 | global: |
安装 Node Exporter
- 一键脚本
bash -c "$(curl -sL https://raw.githubusercontent.com/uerax/script/master/node-exporter.sh)" @
添加 Node
- 要注意由于 Grafana 和 Prometheus 都是安装在 Docker 里, 无法用 127.0.0.1 进行互相访问, 需要用
ip address
查询 Docker 对应的 IP 段才可以访问
1 | scrape_configs: |