11. Node_exporter 一篇就够

11.1解压安装

tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz

groupadd prometheus2

useradd -g prometheus2 -m -d /home/monitor/node_exporter/ -s /sbin/nologin prometheus2

mv node_exporter-0.18.1.linux-amd64 node_exporter

rm -rf node_exporter-0.18.1.linux-amd64

11.2自启动

touch /usr/lib/systemd/system/node_exporter.service

chown prometheus2:prometheus2 /usr/lib/systemd/system/node_exporter.service

chown -R prometheus2:prometheus2 /home/monitor/node_exporter

vim /usr/lib/systemd/system/node_exporter.service

配置

[Unit]

Description=node_exporter

After=network.target

[Service]

Type=simple

User=prometheus2

ExecStart=/home/monitor/node_exporter/node_exporter

Restart=on-failure

[Install]

WantedBy=multi-user.target

启动

systemctl daemon-reload

systemctl enable node_exporter.service

systemctl start node_exporter.service

systemctl status node_exporter.service

systemctl stop node_exporter.service

systemctl restart node_exporter.service

11.3节点配置到Prometheus

image.png

scrape_configs:

The job name is added as a label job=<job_name> to any timeseries scraped from this config.

  • job_name: "prometheus"

metrics_path defaults to '/metrics'

# scheme defaults to 'http'.

static_configs:

  • targets: ["localhost:9090"]

新添加的对其它node节点抓取数据

  • job_name: '10.2'

static_configs:

  • targets: ['172.16.10.2:9100']

    • job_name: '10.3'

      static_configs:

  • targets: ['172.16.10.3:9100']

linux选择模板9276

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
禁止转载,如需转载请通过简信或评论联系作者。

相关阅读更多精彩内容

友情链接更多精彩内容