node-exporter https认证

  • 官网: https://github.com/prometheus/prometheus

  • Prometheus 各模块下载: https://prometheus.io/download/

  • Prometheus下载地址: https://github.com/prometheus/prometheus/releases/tag/v2.28.0

  • 摸版下载: https://github.com/starsliao/Prometheus/tree/master/node_exporter

  • node_exporter官网: https://github.com/prometheus/node_exporter

  • Grafana安装下载地址: https://grafana.com/docs/grafana/latest/installation/

  • Grafana各系统安装下载: https://grafana.com/docs/grafana/latest/installation/

v1.0.0 版本以下不支持 Basic Auth ,所以需要下载 v.1.0.0 以上

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

添加 Basic Auth

  • 1、为 Node Exporter 配置密码

[root@localhost node_exporter]# yum install httpd-tools -y
[root@localhost node_exporter]# htpasswd -nBC 12 '' |tr -d ':\n'
New password:             # 我这里设置密码: Ye5zHuxUQANGj6Bczq
Re-type new password: 
$2y$12$v0NACvxbfJ/3KeyhQOSyjOkdLOXh26qBQEo5VqqTlAvwSDUVcO9yS

# 把生成的秘钥放到 node.yaml
[root@localhost node_exporter]# cat > node.yaml <<EOF
basic_auth_users:
  # 当前设置的用户名为 prometheus , 可以设置多个
  prometheus: $2y$12$v0NACvxbfJ/3KeyhQOSyjOkdLOXh26qBQEo5VqqTlAvwSDUVcO9yS
<<EOF
  • 2、启动测试是否有 Basic Auth 认证

  • 3、配置 Prometheus 使用 Basic Auth

Node Exporter 使用 TLS

1、生产证书文件

2、编写 node.yaml 配置文件

3、启动测试是否有证书

4、配置 Prometheus 使用 TLS

Basic Auth + TLS

node_exporter 配置文件

prometheus 配置文件

Last updated