node exporter 系统指标
最后更新于:2022-04-02 03:00:13
[TOC]
> [github node exporter](https://github.com/prometheus/node_exporter)
> [prometheus node exporter 安装教程](https://prometheus.io/docs/guides/node-exporter/)
## 收集服务器指标
- node_exporter 都是直接运行在要收集指标的服务器上的
- 官方不推荐用 Docker 来运行 node_exporter
### 安装 node_exporter
```
wget https://github.com/prometheus/node_exporter/releases/download/v0.16.0/node_exporter-0.16.0.linux-amd64.tar.gz
tar xvfz node_exporter-0.16.0.linux-amd64.tar.gz
cd node_exporter-0.16.0.linux-amd64
./node_exporter
```
### 查看
启动后查看
```
curl http://localhost:9100/metrics
```
### 添加到 prometheus
修改 prometheus.yaml
```
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['192.168.0.107:9090']
- job_name: 'server'
static_configs:
- targets: ['192.168.0.107:9100']
```
### 重启服务
docker
```
docker restart prometheus_id
```
原生安装,直接发送`HUP`型号
```
killall -HUP prometheus
```
### 验证服务是否开启
查看 prometheus web `http://192.168.0.229:9090/targets`查看是否添加
### 添加到 grafana
1. 查看 https://grafana.com/grafana/dashboards?search=node%20exporter 搜索 grafana dashboards,并复制id
2. 进入 grafana, dashboard->manage->import-> 输入id
常用的 dashboards:[Node Exporter Server Metrics(id:405)](https://grafana.com/dashboards/405)或者[Node Exporter Full(id:1860)](https://grafana.com/dashboards/1860)
';