Restart=on-failure
[Install]
WantedBy=multi-user.target
```
+ **启动**
```
# 设置开机自启动
systemctl enable node_exporter
# 启动服务
systemctl start node_exporter
# 查看服务状态
systemctl status node_exporter
```
+ **配置Prometheus**
```
vim /opt/prometheus-2.26/prometheus.yml
```
```
scrape\_configs:
- job\_name: 'prometheus'
static\_configs:
- targets: ['localhost:9090']
# 增加以下内容
- job\_name: 'linux'
static\_configs:
- targets: ['localhost:9100']
labels:
instance: node1
```
- 重启prometheus
```
systemctl restart prometheus.service
```
+ **验证**:http://node1:9090

![image-20211005184633663](https://img-blog.csdnimg.cn/img_convert/7234555b38acdc00315933dd4e6734bc.