创建配置文件
vim /opt/node_exporter/configuration.yml
输入以下内容
tls_server_config: cert_file: /opt/node_exporter/tlsCertificate.crt key_file: /opt/node_exporter/tlsCertificate.key basic_auth_users: prometheus: '$2y$10$cA9UlOBRKkOsKC2lWhe9c.coKHBMiB9GIOIuIXAvI3CoKKIJuFPom'
上传证书到/opt/node_exporter/
cd /opt/node_exporter/
證書存放路徑:``
systemctl方式開機啟動配置
刪除舊的node_exporter.service
rm -rf /lib/systemd/system/node_exporter.service
創建新的node_exporter.service
vim /lib/systemd/system/node_exporter.service
輸入以下內容:
[Unit] Description=The node_exporter After=network.target [Service] Type=simple User=root ExecStart=/opt/node_exporter/latest/node_exporter --web.config.file=/opt/node_exporter/configuration.yml Restart=on-failure [Install] WantedBy=multi-user.target
啟動
systemctl daemon-reload systemctl restart node_exporter.service systemctl enable node_exporter.service systemctl status node_exporter.service
查看
curl 127.0.0.1:9100/metrics
本文作者:澳门🇲🇴上班的IT人
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!