首页 > 其他分享 >Prometheus监控之TLS

Prometheus监控之TLS

时间:2022-11-25 10:03:42浏览次数:29  
标签:TLS web -- config prometheus Prometheus usr 监控 local

一、说明

在basic_auth账号密码的基础上加上tls加密,密码密钥双保险。

二、配置

1、生成秘钥文件

openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout prom-test.key -out prom-test.crt -subj \
"/C=CN/ST=Beijing/L=Beijing/O=Moelove.info/CN=localhost"

2、将tls密钥文件写入config.yml

vi /usr/local/prometheus/config.yml
basic_auth_users:
# 当前设置的用户名为admin, 可以设置多个
admin: $2y$12$mMnPuKlOQ97ff4NjDsQTMukAtRS/ILpjxjEQrCN0vefs0CBLe/hi6
tls_server_config: # TLS加密
cert_file: prom-test.crt
key_file: prom-test.key

#将秘钥文件放在和config.yml同级目录

3、修改prometheus.yml

scrape_configs:
- job_name: 'prometheus'
basic_auth:
username: admin
password: 123456
#新增tls配置
scheme: https
tls_config:
ca_file: prom-test.crt #crt文件名
insecure_skip_verify: true # 跳过不安全认证
static_configs:
- targets: ['192.168.10.131:9090']

4、启动并测试

1、启动
/usr/local/prometheus/prometheus \
--config.file=/usr/local/prometheus/prometheus.yml \
--web.config.file=/usr/local/prometheus/config.yml \
--storage.tsdb.path="/usr/local/prometheus/data" \
--storage.tsdb.retention=15d \
--web.console.templates="/usr/local/prometheus/consoles" \
--web.console.libraries="/usr/local/prometheus/console_libraries" \
--web.max-connections=512 \
--web.external-url "http://192.168.10.131:9090" \
--web.listen-address=192.168.10.131:9090 &>/usr/local/prometheus/prometheus.log &

2、测试http协议
http://192.168.10.131:9090
"Client sent an HTTP request to an HTTPS server."

3、测试https协议
https://192.168.10.131:9090
会出现登录弹窗,输入账号密码登录之后检查target

三、对接grafana

数据源配置处修改http-url,新增勾选"Basic auth"、"TLS Client Auth"、"Skip TLS Verify"

1、配置Basic Auth Details

Prometheus监控之TLS_文件写入

2、TLS/SSL Auth Details

填写ServerName,将生成的crt、key文件内密钥信息填写入Client Cert、Client Key文本框内

Prometheus监控之TLS_文件写入_02

3、勾选Skip TLS Verify

如果不勾选,save的时候会报错"HTTP Error Bad Gateway"

4、可以连接测试

Prometheus监控之TLS_用户名_03

标签:TLS,web,--,config,prometheus,Prometheus,usr,监控,local
From: https://blog.51cto.com/u_13236892/5885577

相关文章

  • Prometheus监控之使用nginxBasic认证
    mkdir-p/etc/nginxhtpasswd-c/etc/nginx/.htpasswdadminhttp{server{listen12321;location/prometheus{auth_basic......
  • 数据监控预警系统,实现不同端信息推送
    数据是反映产品和用户状态最真实的一种方式,通过数据指导运营决策,驱动业务增长。数据可分为2种情况:数据监控和数据分析;Wyn嵌入式商业智能软件就提供了完整的数据监控和数据分......
  • 数据监控预警系统,实现不同端信息推送
    数据是反映产品和用户状态最真实的一种方式,通过数据指导运营决策,驱动业务增长。数据可分为2种情况:数据监控和数据分析;Wyn嵌入式商业智能软件就提供了完整的数据监控和数据......
  • 动环监控模块--关于数壳
    动环监控模块的一些功能特性:通过温湿度传感器,监控机房内各个位置的温湿度情况,实时显示机房内温湿度,保持良好的运行环境,能使服务器发挥更好的性能,可以根据温湿度的变化,了......
  • Git Clone错误解决:GnuTLS recv error (-110): The TLS connection was non-properly t
    如果你在终端里输入gitclone"https地址" 报以下错误:GnuTLSrecverror(-110):TheTLSconnectionwasnon-properlyterminated.意思是:TLS连接未正确终止。解决......
  • Mnikube 安装 Prometheus + grafana
    官网:Prometheus,GrafanaGithub:kube-prometheusGrafana:官方单独集成K8Skube-prometheus:存储库收集Kubernetes清单、Grafana仪表板和Prometheus规则,结合文档和脚......
  • kube-prometheus监控k8s组件
    下载gitclone-brelease-0.7https://github.com/prometheus-operator/kube-prometheus.git安装cdkube-prometheus/manifestskubectlcreate-fsetup/kubect......
  • 乐维监控与Zabbix对比分析(一)——架构、性能
    近年来,Zabbix凭借其近乎无所不能的监控及优越的性能一路高歌猛进,在开源监控领域独占鳌头;而作为后起的新锐监控平台——乐维监控,则不断吸收Zabbix,Prometheus等优秀开源平台......
  • zabbix监控网络断网情况--初级版
    zabbix初级监控,通过IMCP方式PING即可添加网络网关IP地址,鉴于zabbix一般报警方式采取发送邮件、钉钉、微信报警需要网络环境支持,于是至少设置zabbix服务器双网通,建议有条件......
  • kube-prometheus监控kube-controller-manager没数据-解决
    问题描述监控系统搭建好后,kube-controller-manager和kube-scheduler没有数据:背景描述Kubernetes版本:1.20.1kube-prometheus版本:0.7版本说明:https://github.com/pro......