node_exporter部署

警告
本文最后更新于 2020-08-26 11:00,文中内容可能已过时。

下载安装node_exporter:

1
2
3
4
wget https://github.91chifun.workers.dev//https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz
tar xf node_exporter-1.0.1.linux-amd64.tar.gz
cd node_exporter-1.0.1.linux-amd64/
mv node_exporter  /usr/local/bin/

添加启动用户:

1
useradd prometheus

配置启动服务: vim /usr/lib/systemd/system/node_exporter.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[Unit]
Description=node_export
Documentation=https://github.com/prometheus/node_exporter
After=network.target

[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/bin/node_exporter \
          --collector.tcpstat \
          --collector.systemd
Restart=on-failure
[Install]
WantedBy=multi-user.target

启动:

1
2
systemctl start node_exporter.service
systemctl enable node_exporter.service

添加prometheus配置:

1
2
3
      - job_name: database_node_exporter
        static_configs:
        - targets: ['10.0.0.72:9100','10.0.0.73:9100']
请我喝杯水
SoulChild 微信号 微信号
SoulChild 微信打赏 微信打赏
0%