李光春

Debian:安装node_exporter

· 李光春

一键准备环境

mkdir node_exporter && cd node_exporter && wget https://files.m.daocloud.io/github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz && tar -xvzf node_exporter-1.8.1.linux-amd64.tar.gz 

编辑 systemd 文件

nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target

[Service]
User=root 
ExecStart=/root/node_exporter/node_exporter-1.8.1.linux-amd64/node_exporter
Restart=always

[Install]
WantedBy=multi-user.target

一键完成

sudo systemctl daemon-reload && sudo systemctl start node_exporter && sudo systemctl enable node_exporter && sudo systemctl status node_exporter && netstat -nlpt

创建文件夹

mkdir node_exporter && cd node_exporter

进入文件夹

cd node_exporter

下载文件

wget https://github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz

下载文件(加速)

wget https://files.m.daocloud.io/github.com/prometheus/node_exporter/releases/download/v1.8.1/node_exporter-1.8.1.linux-amd64.tar.gz

解压文件并进入

tar -xvzf node_exporter-1.8.1.linux-amd64.tar.gz

进入解压文件夹

cd node_exporter-1.8.1.linux-amd64

编辑 systemd 文件

nano /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target

[Service]
User=root 
ExecStart=/root/node_exporter/node_exporter-1.8.1.linux-amd64/node_exporter
Restart=always

[Install]
WantedBy=multi-user.target

重新加载配置

sudo systemctl daemon-reload

启动服务

sudo systemctl start node_exporter

设置开机自启

sudo systemctl enable node_exporter 

查看状态

sudo systemctl status node_exporter

查看端口9100是否开启

netstat -nlpt