Haproxy http 检查字符串在 go 运行时之后无法访问 mysqld-exporter 指标

问题描述 投票:0回答:1

我尝试设置 HAproxy http-check,但它无法与 mariadb_exporter 指标列表一起使用:

    backend galera-nodes
      mode tcp
      option srvtcpka
      option httpchk GET /metrics
      #http-check expect string go_threads <- this one works as last one from list
      # http-check expect string mysql_engine_innodb_read_views_open_inside_innodb < this one is broken and it's first metric not from go runtime metrics      
      http-check expect string mysql_global_variables_wsrep_on\ 1 # I want this one to work, but it doesn't want to for some reason
      balance first

      default-server init-addr none check resolvers mydns
      server node-0 mariadb-0.mariadb.test-mariadb.svc.cluster.local:3306 check port 9104
      server node-1 mariadb-1.mariadb.test-mariadb.svc.cluster.local:3306 check port 9104 backup
      server node-2 mariadb-2.mariadb.test-mariadb.svc.cluster.local:3306 check port 9104 backup

问题非常有趣,因为我可以访问有关 go 运行时的列表顶部指标,例如:

# HELP go_gc_cycles_automatic_gc_cycles_total Count of completed GC cycles generated by the Go runtime.
# TYPE go_gc_cycles_automatic_gc_cycles_total counter
go_gc_cycles_automatic_gc_cycles_total 148211
# HELP go_gc_cycles_forced_gc_cycles_total Count of completed GC cycles forced by the application.
# TYPE go_gc_cycles_forced_gc_cycles_total counter
go_gc_cycles_forced_gc_cycles_total 0

我无法访问计量之后的任何内容,阻塞指标 mysql_exporter_last_scrape_error,例如:

# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 10
# HELP mysql_engine_innodb_read_views_open_inside_innodb Read views open inside InnoDB.
# TYPE mysql_engine_innodb_read_views_open_inside_innodb gauge
mysql_engine_innodb_read_views_open_inside_innodb 0
# HELP mysql_exporter_collector_duration_seconds Collector time duration.
# TYPE mysql_exporter_collector_duration_seconds gauge
mysql_exporter_collector_duration_seconds{collector="collect.engine_innodb_status"} 0.000647209
mysql_exporter_collector_duration_seconds{collector="collect.global_status"} 0.006044561
mysql_exporter_collector_duration_seconds{collector="collect.global_variables"} 0.010484458
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.innodb_cmp"} 0.000210445
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.innodb_cmpmem"} 0.000821883
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.query_response_time"} 0.010943727
mysql_exporter_collector_duration_seconds{collector="collect.slave_status"} 0.000288631
mysql_exporter_collector_duration_seconds{collector="connection"} 0.00164831
# HELP mysql_exporter_last_scrape_error Whether the last scrape of metrics from MySQL resulted in an error (1 for error, 0 for success).
# TYPE mysql_exporter_last_scrape_error gauge-
mysql_exporter_last_scrape_error 0 #### <--- this one is inaccessible 

go_threads 有效,mysql_exporter_collector_duration_seconds 有效,下面的每个指标都被破坏(使用随机指标验证)

我看不到任何损坏/特殊字符:

# HELP go_threads Number of OS threads created.^M$
# TYPE go_threads gauge^M$
go_threads 10^M$
# HELP mysql_engine_innodb_read_views_open_inside_innodb Read views open inside InnoDB.^M$
# TYPE mysql_engine_innodb_read_views_open_inside_innodb gauge^M$
mysql_engine_innodb_read_views_open_inside_innodb 0^M$
# HELP mysql_exporter_collector_duration_seconds Collector time duration.^M$
# TYPE mysql_exporter_collector_duration_seconds gauge^M$
mysql_exporter_collector_duration_seconds{collector="collect.engine_innodb_status"} 0.000566157^M$
mysql_exporter_collector_duration_seconds{collector="collect.global_status"} 0.005119717^M$
mysql_exporter_collector_duration_seconds{collector="collect.global_variables"} 0.010971451^M$
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.innodb_cmp"} 0.000200721^M$
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.innodb_cmpmem"} 0.000738683^M$
mysql_exporter_collector_duration_seconds{collector="collect.info_schema.query_response_time"} 0.011611622^M$
mysql_exporter_collector_duration_seconds{collector="collect.slave_status"} 0.011444507^M$
mysql_exporter_collector_duration_seconds{collector="connection"} 0.001675709^M$
# HELP mysql_exporter_last_scrape_error Whether the last scrape of metrics from MySQL resulted in an error (1 for error, 0 for success).^M$
# TYPE mysql_exporter_last_scrape_error gauge^M$
mysql_exporter_last_scrape_error 0^M$
# HELP mysql_exporter_scrapes_total Total number of times MySQL was scraped for metrics.^M$
# TYPE mysql_exporter_scrapes_total counter^M$
mysql_exporter_scrapes_total 92990^M$

它是某种缓冲区吗?有人以前遇到过这样的问题吗?

Haproxy版本:HAProxy版本2.8.1-a90123a,2023/07/03发布 导出版本:mysqld-exporter:0.14.0-debian-11-r137

我尝试过:

  • 不同的指标
  • 按字符串搜索,rstring
  • 手动验证一切正常
  • curl 和 telnet 特定端点,它的工作方式就像一个魅力

我希望 haproxy 可以按预期获取并找到指标

metrics haproxy
1个回答
0
投票

通过增加缓冲区解决:

    global
      (...)
      tune.bufsize 123456789

根据您的要求调整大小,但请小心阅读:https://docs.haproxy.org/2.8/configuration.html#3.2-tune.bufsize

© www.soinside.com 2019 - 2024. All rights reserved.