从零开始的Linux运维屌丝之路,资源免费分享平台   运维人员首选:简单、易用、高效、安全、稳定、社区活跃的开源软件
  • 首页
  • 监控
  • Prometheus通过remote_write远程写入功能

Prometheus通过remote_write远程写入功能

发布:蔺要红08-23分类: 监控

 

开启remote_write_receiver  远程写的接口地址/api/v1/write

Prometheus_B 需要打开接收远程写入的功能,通过增加启动参数--web.enable-remote-write-receiver

 

./prometheus --web.enable-remote-write-receiver --web.config.file=web.yml --web.listen-address=0.0.0.0:9090

 

开启认证

apt install apache2-utils
htpasswd -nB '' | tr -d ':'

web配置文件web.yml

basic_auth_users:
  admin: $2y$05$UKSS18ztdsUNoEuXYScr2OE1TCMe1hWnmD6JuwUi/uPTJayHIakae

访问

后面访问控制台页面或者调用接口都需要指定账号密码了

curl -u admin:xxxxx http://localhost:9090

其他Prometheus如果需要往这台写入, 需要在remote_write配置认证
 

remote_write

Prometheus_A 的配置文件如下 开始往B写入

 
remote_write:
- url: "http://127.0.0.1:9090/api/v1/write"
  basic_auth:                   # 开启认证后需要配置
    username: admin             # 开启认证后需要配置
    password: xxxxxx            # 开启认证后需要配置
  remote_timeout: 30s
  tls_config:
    insecure_skip_verify: true
  queue_config:
    capacity: 500
    max_shards: 1000
    min_shards: 1
    max_samples_per_send: 100
    batch_send_deadline: 5s
    min_backoff: 30ms
    max_backoff: 100ms
温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,如有侵权我会在24小时之内删除!

欢迎使用手机扫描访问本站