不断学习 · 持续进步 Skip to main content

Node-Exporter

安装 node-exporter

tar xvfz node_exporter-1.8.2.linux-amd64.tar.gz
cd node_exporter-1.8.2.linux-amd64
./node_exporter

Bcrypt 加密 gin 用户密码

apt install apache2-utils -y

htpasswd -nB gin

编辑 Web-config.yml 配置文件

tls_server_config:
  cert_file: <filename>
  key_file: <filename>
  client_auth_type: RequireAndVerifyClientCert
  client_ca_file: <filename>
  client_allowed_sans:
    - "example.com"
    - "192.168.1.1"
    - "[email protected]"
    - "https://example.com/uri"
  min_versio: TLS12
  max_version: TLS13
http_server_config:
  headers:
basic_auth_users:
  gin: <secret>

启动 node-exporter

./node_exporter --web.listen-address=127.0.0.1:8081 --web.config.file=
./node_exporter --web.listen-address=127.0.0.1:8082 --web.config.file=
./node_exporter --web.listen-address=127.0.0.1:8083 --web.config.file=

创建用户 node_exporter

useradd node_exporter

修改目录权限

chown node_exporter:node_exporter /usr/local/node_exporter/

编写 node-exporter.service 服务配置文件

[Unit]
Description=Node_Exporter

[Service]
WorkingDirectory=/usr/local/node-exporter
ExecStart=/usr/local/node_exporter/node_exporter --web.listen-address 127.0.0.1:8081 --web.config.file=Web-config.yml
#Restart=always
User=node_exporter
Group=node_exporter


[Install]
WantedBy=multi-user.target

启动服务

systemctl daemon-reload
systemctl enable --now node_exporter.service