作者:灯火阑珊2502936477 | 来源:互联网 | 2023-05-18 05:14
1.下载镜像包{代码}2.启动node-exporter{代码}拜访url:[链接]这些都是收集到数据,有了它就能够做数据展现了.3.启动prometheus新建目录prometheus
1.下载镜像包
docker pull prom/node-exporter
docker pull prom/prometheus
docker pull grafana/grafana
2.启动node-exporter
docker run -d -p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
prom/node-exporter
拜访url:http://192.168.91.132:9100/me…
这些都是收集到数据,有了它就能够做数据展现了.
3.启动prometheus
新建目录prometheus,编辑配置文件prometheus.yml
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
留神:批改IP地址,这里的192.168.91.132就是本机地址
启动prometheus
docker run -d \
-p 9090:9090 \
-v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus
拜访url:
http://192.168.91.132:9090/graph
启动grafana
新建空文件夹grafana-storage,用来存储数据
mkdir /opt/grafana-storage
chmod 777 -R /opt/grafana-storage
启动grafana
docker run -d \
-p 3000:3000 \
--name=grafana \
-v /opt/grafana-storage:/var/lib/grafana \
grafana/grafana
拜访url:
http://192.168.91.132:3000/
默认会先跳转到登录页面,默认的用户名和明码都是admin
参考:https://www.cnblogs.com/xiao9…