Node Exporter 可以通过以下方式获取网络端口发送包数:
- 首先,启用 Node Exporter 的 netstat collector。在配置文件
prometheus.yml
中添加以下内容:
- job_name: 'node'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9100']
metrics_path: /node_exporter/metrics
params:
collector[]: [netstat]
- 然后,在 Prometheus 中查询
node_network_transmit_packets_total
指标,例如:
node_network_transmit_packets_total{device="eth0"}
这将返回 eth0
网络端口的发送包数。您可以更改 device
标签以获取其他网络端口的数据。