1、防火墙配置
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="10.255.200.1/30" port protocol="tcp" port="9100" accept"

# 重新载入防火墙配置,使配置生效
firewall-cmd --reload
2、下载node_exporter
最新版下载链接:https://github.com/prometheus/node_exporter/releases
cd /sas/prometheus/
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz

tar -xzvf node_exporter-1.0.1.linux-amd64.tar.gz
mv node_exporter-1.0.1.linux-amd64 node_exporter
3、编写Systemd服务管理配置文件
vi /usr/lib/systemd/system/node_exporter.service

[Unit]
Description=Prometheus Node Exporter Services
After=network.target remote-fs.target

[Service]
Type=simple
ExecStart=/sas/prometheus/node_exporter/node_exporter
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
4、启动node_exporter服务
systemctl daemon-reload

systemctl start node_exporter
systemctl status node_exporter
systemctl enable node_exporter
5、配置prometheus采集node_exporter监控数据

vi /sas/prometheus/prometheus/prometheus.yml

# scrape_configs下添中新的监控任务
scrape_configs:

  ......

  - job_name: 'node_exporter'
    scrape_interval: 5s
    static_configs:
    - targets: ['10.255.200.1:9100','10.255.200.2:9100','10.255.200.3:9100']

# 重新启动prometheus服务
systemctl restart prometheus
systemctl status prometheus
6、在grafana中配置监控信息展示模版

使用浏览器打开:https://10.255.200.5:3000 , 在 “DashBoards” -> "Manage" 中导入node_exporter展示模版,相关的模版可以从“https://grafana.com/grafana/dashboards” 搜索选用,此次选用ID为8919的中文node_exporter展示模版,从“https://grafana.com/grafana/dashboards/8919” 下载JSON文件,然后导入。或者服务器可以联网的情况下,在导入界面输入模版ID,从grafana服务器直接载入(Load)。或者是将模版具体的JSON文件内容复制粘贴到对应的配置文本框中载入。

模版导入

模版导入

模版效果