docker的环境,此处就不配置了,自行百度,很简单
docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" prom/node-exporter
http://192.168.31.60:9100/metrics
1、创建文件夹
mkdir /opt/prometheus
cd /opt/prometheus/
vim prometheus.yml
2、编辑如下
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.31.60:9100']
labels:
instance: localhost
3、启动
docker run -d -p 9090:9090 \
-v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
http://192.168.31.60:9090/targets
1、新建空文件夹grafana-storage,用来存储数据
mkdir /opt/grafana-storage
2、设置权限
chmod 777 -R /opt/grafana-storage
3、启动
docker run -d -p 3000:3000 --name=grafana \
-v /opt/grafana-storage:/var/lib/grafana grafana/grafana
http://192.168.31.60:3000/
1、prometheus连接node-exporter失败,先关闭防火墙再试
2、关闭防火墙之后,重启docker服务service docker restart
3、默认的用户名和密码都是admin