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= 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

你可能感兴趣的:(11. Node_exporter 一篇就够)