从Prometheus官方网站可以看到,官方网站已经有支持对HAProxy软件的exporter,我们从官方网站下载下来进行使用,也可以通过下载HAProxy的项目地址,通过编译进行部署。
github项目地址
https://github.com/prometheus/haproxy_exporter
二进制可执行程序地址
https://prometheus.io/download/
原理解析
通过查看源码,haproxy_exporter是对uri地址获取到的csv内容进行解析,所以需要配置HAProxy,以便暴露HAProxy的状态信息。
func (e *Exporter) scrape(ch chan<- prometheus.Metric) (up float64) {
e.totalScrapes.Inc()
body, err := e.fetch()
if err != nil {
level.Error(e.logger).Log("msg", "Can't scrape HAProxy", "err", err)
return 0
}
defer body.Close()
reader := csv.NewReader(body)
reader.TrailingComma = true
reader.Comment = '#'
loop:
for {
row, err := reader.Read()
switch err {
case nil:
case io.EOF:
break loop
default:
if _, ok := err.(*csv.ParseError); ok {
level.Error(e.logger).Log("msg", "Can't read CSV", "err", err)
e.csvParseFailures.Inc()
continue loop
}
level.Error(e.logger).Log("msg", "Unexpected error while reading CSV", "err", err)
return 0
}
e.parseRow(row, ch)
}
return 1
}
HAProxy配置:
打开haproxy.cfg配置文件,添加如下配置项
listen stats
bind :9099
stats uri /haproxy
stats enable
该配置项将HAProxy的状态信息进行曝露,绑定在端口9099,并且路由地址为/haproxy。
通过访问该地址,我们可以看到相应的HAProxy状态信息。
HAProxy_exporter配置
haproxy_exporter.exe --haproxy.scrape-uri="http://192.168.55.80:9099/haproxy;csv"
配置命令行参数–haproxy.scrape-uri 为指向HAProxy的状态信息的地址即可。
监控效果
访问exporter曝露的/metrics,可以访问到HAProxy的状态信息。
haproxy_backend_bytes_in_total{backend="app"} 2020
haproxy_backend_bytes_in_total{backend="static"} 0
haproxy_backend_bytes_in_total{backend="stats"} 11258
# HELP haproxy_backend_bytes_out_total Current total of outgoing bytes.
# TYPE haproxy_backend_bytes_out_total gauge
haproxy_backend_bytes_out_total{backend="app"} 12400
haproxy_backend_bytes_out_total{backend="static"} 0
haproxy_backend_bytes_out_total{backend="stats"} 237858
# HELP haproxy_backend_compressor_bytes_bypassed_total Number of bytes that bypassed the HTTP compressor
# TYPE haproxy_backend_compressor_bytes_bypassed_total gauge
haproxy_backend_compressor_bytes_bypassed_total{backend="app"} 0
haproxy_backend_compressor_bytes_bypassed_total{backend="static"} 0
haproxy_backend_compressor_bytes_bypassed_total{backend="stats"} 0
# HELP haproxy_backend_compressor_bytes_in_total Number of HTTP response bytes fed to the compressor
# TYPE haproxy_backend_compressor_bytes_in_total gauge
haproxy_backend_compressor_bytes_in_total{backend="app"} 0
haproxy_backend_compressor_bytes_in_total{backend="static"} 0
haproxy_backend_compressor_bytes_in_total{backend="stats"} 0
# HELP haproxy_backend_compressor_bytes_out_total Number of HTTP response bytes emitted by the compressor
# TYPE haproxy_backend_compressor_bytes_out_total gauge
haproxy_backend_compressor_bytes_out_total{backend="app"} 0
haproxy_backend_compressor_bytes_out_total{backend="static"} 0
haproxy_backend_compressor_bytes_out_total{backend="stats"} 0
# HELP haproxy_backend_connection_errors_total Total of connection errors.
# TYPE haproxy_backend_connection_errors_total gauge
haproxy_backend_connection_errors_total{backend="app"} 0
haproxy_backend_connection_errors_total{backend="static"} 0
haproxy_backend_connection_errors_total{backend="stats"} 16
# HELP haproxy_backend_current_queue Current number of queued requests not assigned to any server.
# TYPE haproxy_backend_current_queue gauge
haproxy_backend_current_queue{backend="app"} 0
haproxy_backend_current_queue{backend="static"} 0
haproxy_backend_current_queue{backend="stats"} 0
# HELP haproxy_backend_current_server Current number of active servers
# TYPE haproxy_backend_current_server gauge
haproxy_backend_current_server{backend="app"} 2
haproxy_backend_current_server{backend="static"} 0
haproxy_backend_current_server{backend="stats"} 0
# HELP haproxy_backend_current_session_rate Current number of sessions per second over last elapsed second.
# TYPE haproxy_backend_current_session_rate gauge
haproxy_backend_current_session_rate{backend="app"} 0
haproxy_backend_current_session_rate{backend="static"} 0
haproxy_backend_current_session_rate{backend="stats"} 0
# HELP haproxy_backend_current_sessions Current number of active sessions.
# TYPE haproxy_backend_current_sessions gauge
haproxy_backend_current_sessions{backend="app"} 0
haproxy_backend_current_sessions{backend="static"} 0
haproxy_backend_current_sessions{backend="stats"} 0
# HELP haproxy_backend_http_connect_time_average_seconds Avg. HTTP connect time for last 1024 successful connections.
# TYPE haproxy_backend_http_connect_time_average_seconds gauge
haproxy_backend_http_connect_time_average_seconds{backend="app"} 0.001
haproxy_backend_http_connect_time_average_seconds{backend="static"} 0
haproxy_backend_http_connect_time_average_seconds{backend="stats"} 0
# HELP haproxy_backend_http_queue_time_average_seconds Avg. HTTP queue time for last 1024 successful connections.
# TYPE haproxy_backend_http_queue_time_average_seconds gauge
haproxy_backend_http_queue_time_average_seconds{backend="app"} 0
haproxy_backend_http_queue_time_average_seconds{backend="static"} 0
haproxy_backend_http_queue_time_average_seconds{backend="stats"} 0
# HELP haproxy_backend_http_response_time_average_seconds Avg. HTTP response time for last 1024 successful connections.
# TYPE haproxy_backend_http_response_time_average_seconds gauge
haproxy_backend_http_response_time_average_seconds{backend="app"} 0.001
haproxy_backend_http_response_time_average_seconds{backend="static"} 0
haproxy_backend_http_response_time_average_seconds{backend="stats"} 0
# HELP haproxy_backend_http_responses_compressed_total Number of HTTP responses that were compressed
# TYPE haproxy_backend_http_responses_compressed_total gauge
haproxy_backend_http_responses_compressed_total{backend="app"} 0
haproxy_backend_http_responses_compressed_total{backend="static"} 0
haproxy_backend_http_responses_compressed_total{backend="stats"} 0
# HELP haproxy_backend_http_responses_total Total of HTTP responses.
# TYPE haproxy_backend_http_responses_total gauge
haproxy_backend_http_responses_total{backend="app",code="1xx"} 0
haproxy_backend_http_responses_total{backend="app",code="2xx"} 5
haproxy_backend_http_responses_total{backend="app",code="3xx"} 0
haproxy_backend_http_responses_total{backend="app",code="4xx"} 0
haproxy_backend_http_responses_total{backend="app",code="5xx"} 0
haproxy_backend_http_responses_total{backend="app",code="other"} 0
haproxy_backend_http_responses_total{backend="static",code="1xx"} 0
haproxy_backend_http_responses_total{backend="static",code="2xx"} 0
haproxy_backend_http_responses_total{backend="static",code="3xx"} 0
haproxy_backend_http_responses_total{backend="static",code="4xx"} 0
haproxy_backend_http_responses_total{backend="static",code="5xx"} 0
haproxy_backend_http_responses_total{backend="static",code="other"} 0
haproxy_backend_http_responses_total{backend="stats",code="1xx"} 0
haproxy_backend_http_responses_total{backend="stats",code="2xx"} 0
haproxy_backend_http_responses_total{backend="stats",code="3xx"} 0
haproxy_backend_http_responses_total{backend="stats",code="4xx"} 0
haproxy_backend_http_responses_total{backend="stats",code="5xx"} 16
haproxy_backend_http_responses_total{backend="stats",code="other"} 0
# HELP haproxy_backend_http_total_time_average_seconds Avg. HTTP total time for last 1024 successful connections.
# TYPE haproxy_backend_http_total_time_average_seconds gauge
haproxy_backend_http_total_time_average_seconds{backend="app"} 0.014
haproxy_backend_http_total_time_average_seconds{backend="static"} 0
haproxy_backend_http_total_time_average_seconds{backend="stats"} 0.02
# HELP haproxy_backend_limit_sessions Configured session limit.
# TYPE haproxy_backend_limit_sessions gauge
haproxy_backend_limit_sessions{backend="app"} 300
haproxy_backend_limit_sessions{backend="static"} 300
haproxy_backend_limit_sessions{backend="stats"} 300
# HELP haproxy_backend_max_queue Maximum observed number of queued requests not assigned to any server.
# TYPE haproxy_backend_max_queue gauge
haproxy_backend_max_queue{backend="app"} 0
haproxy_backend_max_queue{backend="static"} 0
haproxy_backend_max_queue{backend="stats"} 0
# HELP haproxy_backend_max_session_rate Maximum number of sessions per second.
# TYPE haproxy_backend_max_session_rate gauge
haproxy_backend_max_session_rate{backend="app"} 2
haproxy_backend_max_session_rate{backend="static"} 0
haproxy_backend_max_session_rate{backend="stats"} 2
# HELP haproxy_backend_max_sessions Maximum observed number of active sessions.
# TYPE haproxy_backend_max_sessions gauge
haproxy_backend_max_sessions{backend="app"} 1
haproxy_backend_max_sessions{backend="static"} 0
haproxy_backend_max_sessions{backend="stats"} 1
# HELP haproxy_backend_redispatch_warnings_total Total of redispatch warnings.
# TYPE haproxy_backend_redispatch_warnings_total gauge
haproxy_backend_redispatch_warnings_total{backend="app"} 0
haproxy_backend_redispatch_warnings_total{backend="static"} 0
haproxy_backend_redispatch_warnings_total{backend="stats"} 0
# HELP haproxy_backend_response_errors_total Total of response errors.
# TYPE haproxy_backend_response_errors_total gauge
haproxy_backend_response_errors_total{backend="app"} 0
haproxy_backend_response_errors_total{backend="static"} 0
haproxy_backend_response_errors_total{backend="stats"} 0
# HELP haproxy_backend_retry_warnings_total Total of retry warnings.
# TYPE haproxy_backend_retry_warnings_total gauge
haproxy_backend_retry_warnings_total{backend="app"} 0
haproxy_backend_retry_warnings_total{backend="static"} 0
haproxy_backend_retry_warnings_total{backend="stats"} 0
# HELP haproxy_backend_server_selected_total Total number of times a server was selected, either for new sessions, or when re-dispatching.
# TYPE haproxy_backend_server_selected_total gauge
haproxy_backend_server_selected_total{backend="app"} 5
haproxy_backend_server_selected_total{backend="static"} 0
haproxy_backend_server_selected_total{backend="stats"} 0
# HELP haproxy_backend_sessions_total Total number of sessions.
# TYPE haproxy_backend_sessions_total gauge
haproxy_backend_sessions_total{backend="app"} 5
haproxy_backend_sessions_total{backend="static"} 0
haproxy_backend_sessions_total{backend="stats"} 16
# HELP haproxy_backend_up Current health status of the backend (1 = UP, 0 = DOWN).
# TYPE haproxy_backend_up gauge
haproxy_backend_up{backend="app"} 1
haproxy_backend_up{backend="static"} 0
haproxy_backend_up{backend="stats"} 1
# HELP haproxy_backend_weight Total weight of the servers in the backend.
# TYPE haproxy_backend_weight gauge
haproxy_backend_weight{backend="app"} 2
haproxy_backend_weight{backend="static"} 0
haproxy_backend_weight{backend="stats"} 0
# HELP haproxy_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which haproxy_exporter was built.
# TYPE haproxy_exporter_build_info gauge
haproxy_exporter_build_info{branch="",goversion="go1.13.4",revision="",version=""} 1
# HELP haproxy_exporter_csv_parse_failures Number of errors while parsing CSV.
# TYPE haproxy_exporter_csv_parse_failures counter
haproxy_exporter_csv_parse_failures 0
# HELP haproxy_exporter_total_scrapes Current total HAProxy scrapes.
# TYPE haproxy_exporter_total_scrapes counter
haproxy_exporter_total_scrapes 1
# HELP haproxy_frontend_bytes_in_total Current total of incoming bytes.
# TYPE haproxy_frontend_bytes_in_total gauge
haproxy_frontend_bytes_in_total{frontend="main"} 2020
haproxy_frontend_bytes_in_total{frontend="stats"} 11258
# HELP haproxy_frontend_bytes_out_total Current total of outgoing bytes.
# TYPE haproxy_frontend_bytes_out_total gauge
haproxy_frontend_bytes_out_total{frontend="main"} 12824
haproxy_frontend_bytes_out_total{frontend="stats"} 237858
# HELP haproxy_frontend_compressor_bytes_bypassed_total Number of bytes that bypassed the HTTP compressor
# TYPE haproxy_frontend_compressor_bytes_bypassed_total gauge
haproxy_frontend_compressor_bytes_bypassed_total{frontend="main"} 0
haproxy_frontend_compressor_bytes_bypassed_total{frontend="stats"} 0
# HELP haproxy_frontend_compressor_bytes_in_total Number of HTTP response bytes fed to the compressor
# TYPE haproxy_frontend_compressor_bytes_in_total gauge
haproxy_frontend_compressor_bytes_in_total{frontend="main"} 0
haproxy_frontend_compressor_bytes_in_total{frontend="stats"} 0
# HELP haproxy_frontend_compressor_bytes_out_total Number of HTTP response bytes emitted by the compressor
# TYPE haproxy_frontend_compressor_bytes_out_total gauge
haproxy_frontend_compressor_bytes_out_total{frontend="main"} 0
haproxy_frontend_compressor_bytes_out_total{frontend="stats"} 0
# HELP haproxy_frontend_current_session_rate Current number of sessions per second over last elapsed second.
# TYPE haproxy_frontend_current_session_rate gauge
haproxy_frontend_current_session_rate{frontend="main"} 0
haproxy_frontend_current_session_rate{frontend="stats"} 1
# HELP haproxy_frontend_current_sessions Current number of active sessions.
# TYPE haproxy_frontend_current_sessions gauge
haproxy_frontend_current_sessions{frontend="main"} 0
haproxy_frontend_current_sessions{frontend="stats"} 1
# HELP haproxy_frontend_http_requests_total Total HTTP requests.
# TYPE haproxy_frontend_http_requests_total gauge
haproxy_frontend_http_requests_total{frontend="main"} 7
haproxy_frontend_http_requests_total{frontend="stats"} 40
# HELP haproxy_frontend_http_responses_compressed_total Number of HTTP responses that were compressed
# TYPE haproxy_frontend_http_responses_compressed_total gauge
haproxy_frontend_http_responses_compressed_total{frontend="main"} 0
haproxy_frontend_http_responses_compressed_total{frontend="stats"} 0
# HELP haproxy_frontend_http_responses_total Total of HTTP responses.
# TYPE haproxy_frontend_http_responses_total gauge
haproxy_frontend_http_responses_total{code="1xx",frontend="main"} 0
haproxy_frontend_http_responses_total{code="1xx",frontend="stats"} 0
haproxy_frontend_http_responses_total{code="2xx",frontend="main"} 5
haproxy_frontend_http_responses_total{code="2xx",frontend="stats"} 13
haproxy_frontend_http_responses_total{code="3xx",frontend="main"} 0
haproxy_frontend_http_responses_total{code="3xx",frontend="stats"} 0
haproxy_frontend_http_responses_total{code="4xx",frontend="main"} 2
haproxy_frontend_http_responses_total{code="4xx",frontend="stats"} 10
haproxy_frontend_http_responses_total{code="5xx",frontend="main"} 0
haproxy_frontend_http_responses_total{code="5xx",frontend="stats"} 16
haproxy_frontend_http_responses_total{code="other",frontend="main"} 0
haproxy_frontend_http_responses_total{code="other",frontend="stats"} 0
# HELP haproxy_frontend_limit_session_rate Configured limit on new sessions per second.
# TYPE haproxy_frontend_limit_session_rate gauge
haproxy_frontend_limit_session_rate{frontend="main"} 0
haproxy_frontend_limit_session_rate{frontend="stats"} 0
# HELP haproxy_frontend_limit_sessions Configured session limit.
# TYPE haproxy_frontend_limit_sessions gauge
haproxy_frontend_limit_sessions{frontend="main"} 3000
haproxy_frontend_limit_sessions{frontend="stats"} 3000
# HELP haproxy_frontend_max_session_rate Maximum observed number of sessions per second.
# TYPE haproxy_frontend_max_session_rate gauge
haproxy_frontend_max_session_rate{frontend="main"} 2
haproxy_frontend_max_session_rate{frontend="stats"} 2
# HELP haproxy_frontend_max_sessions Maximum observed number of active sessions.
# TYPE haproxy_frontend_max_sessions gauge
haproxy_frontend_max_sessions{frontend="main"} 2
haproxy_frontend_max_sessions{frontend="stats"} 2
# HELP haproxy_frontend_request_errors_total Total of request errors.
# TYPE haproxy_frontend_request_errors_total gauge
haproxy_frontend_request_errors_total{frontend="main"} 2
haproxy_frontend_request_errors_total{frontend="stats"} 10
# HELP haproxy_frontend_requests_denied_total Total of requests denied for security.
# TYPE haproxy_frontend_requests_denied_total gauge
haproxy_frontend_requests_denied_total{frontend="main"} 0
haproxy_frontend_requests_denied_total{frontend="stats"} 0
# HELP haproxy_frontend_sessions_total Total number of sessions.
# TYPE haproxy_frontend_sessions_total gauge
haproxy_frontend_sessions_total{frontend="main"} 3
haproxy_frontend_sessions_total{frontend="stats"} 29
# HELP haproxy_server_bytes_in_total Current total of incoming bytes.
# TYPE haproxy_server_bytes_in_total gauge
haproxy_server_bytes_in_total{backend="app",server="app1"} 1282
haproxy_server_bytes_in_total{backend="app",server="app2"} 738
haproxy_server_bytes_in_total{backend="app",server="app3"} 0
haproxy_server_bytes_in_total{backend="app",server="app4"} 0
haproxy_server_bytes_in_total{backend="static",server="static"} 0
# HELP haproxy_server_bytes_out_total Current total of outgoing bytes.
# TYPE haproxy_server_bytes_out_total gauge
haproxy_server_bytes_out_total{backend="app",server="app1"} 11828
haproxy_server_bytes_out_total{backend="app",server="app2"} 572
haproxy_server_bytes_out_total{backend="app",server="app3"} 0
haproxy_server_bytes_out_total{backend="app",server="app4"} 0
haproxy_server_bytes_out_total{backend="static",server="static"} 0
# HELP haproxy_server_check_duration_milliseconds Previously run health check duration, in milliseconds
# TYPE haproxy_server_check_duration_milliseconds gauge
haproxy_server_check_duration_milliseconds{backend="app",server="app1"} 0
haproxy_server_check_duration_milliseconds{backend="app",server="app2"} 0
haproxy_server_check_duration_milliseconds{backend="app",server="app3"} 0
haproxy_server_check_duration_milliseconds{backend="app",server="app4"} 0
haproxy_server_check_duration_milliseconds{backend="static",server="static"} 0
# HELP haproxy_server_check_failures_total Total number of failed health checks.
# TYPE haproxy_server_check_failures_total gauge
haproxy_server_check_failures_total{backend="app",server="app1"} 0
haproxy_server_check_failures_total{backend="app",server="app2"} 1
haproxy_server_check_failures_total{backend="app",server="app3"} 1
haproxy_server_check_failures_total{backend="app",server="app4"} 1
haproxy_server_check_failures_total{backend="static",server="static"} 1
# HELP haproxy_server_connection_errors_total Total of connection errors.
# TYPE haproxy_server_connection_errors_total gauge
haproxy_server_connection_errors_total{backend="app",server="app1"} 0
haproxy_server_connection_errors_total{backend="app",server="app2"} 0
haproxy_server_connection_errors_total{backend="app",server="app3"} 0
haproxy_server_connection_errors_total{backend="app",server="app4"} 0
haproxy_server_connection_errors_total{backend="static",server="static"} 0
# HELP haproxy_server_current_queue Current number of queued requests assigned to this server.
# TYPE haproxy_server_current_queue gauge
haproxy_server_current_queue{backend="app",server="app1"} 0
haproxy_server_current_queue{backend="app",server="app2"} 0
haproxy_server_current_queue{backend="app",server="app3"} 0
haproxy_server_current_queue{backend="app",server="app4"} 0
haproxy_server_current_queue{backend="static",server="static"} 0
# HELP haproxy_server_current_session_rate Current number of sessions per second over last elapsed second.
# TYPE haproxy_server_current_session_rate gauge
haproxy_server_current_session_rate{backend="app",server="app1"} 0
haproxy_server_current_session_rate{backend="app",server="app2"} 0
haproxy_server_current_session_rate{backend="app",server="app3"} 0
haproxy_server_current_session_rate{backend="app",server="app4"} 0
haproxy_server_current_session_rate{backend="static",server="static"} 0
# HELP haproxy_server_current_sessions Current number of active sessions.
# TYPE haproxy_server_current_sessions gauge
haproxy_server_current_sessions{backend="app",server="app1"} 0
haproxy_server_current_sessions{backend="app",server="app2"} 0
haproxy_server_current_sessions{backend="app",server="app3"} 0
haproxy_server_current_sessions{backend="app",server="app4"} 0
haproxy_server_current_sessions{backend="static",server="static"} 0
# HELP haproxy_server_downtime_seconds_total Total downtime in seconds.
# TYPE haproxy_server_downtime_seconds_total gauge
haproxy_server_downtime_seconds_total{backend="app",server="app1"} 0
haproxy_server_downtime_seconds_total{backend="app",server="app2"} 90
haproxy_server_downtime_seconds_total{backend="app",server="app3"} 2491
haproxy_server_downtime_seconds_total{backend="app",server="app4"} 2490
haproxy_server_downtime_seconds_total{backend="static",server="static"} 2492
# HELP haproxy_server_http_responses_total Total of HTTP responses.
# TYPE haproxy_server_http_responses_total gauge
haproxy_server_http_responses_total{backend="app",code="1xx",server="app1"} 0
haproxy_server_http_responses_total{backend="app",code="1xx",server="app2"} 0
haproxy_server_http_responses_total{backend="app",code="1xx",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="1xx",server="app4"} 0
haproxy_server_http_responses_total{backend="app",code="2xx",server="app1"} 3
haproxy_server_http_responses_total{backend="app",code="2xx",server="app2"} 2
haproxy_server_http_responses_total{backend="app",code="2xx",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="2xx",server="app4"} 0
haproxy_server_http_responses_total{backend="app",code="3xx",server="app1"} 0
haproxy_server_http_responses_total{backend="app",code="3xx",server="app2"} 0
haproxy_server_http_responses_total{backend="app",code="3xx",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="3xx",server="app4"} 0
haproxy_server_http_responses_total{backend="app",code="4xx",server="app1"} 0
haproxy_server_http_responses_total{backend="app",code="4xx",server="app2"} 0
haproxy_server_http_responses_total{backend="app",code="4xx",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="4xx",server="app4"} 0
haproxy_server_http_responses_total{backend="app",code="5xx",server="app1"} 0
haproxy_server_http_responses_total{backend="app",code="5xx",server="app2"} 0
haproxy_server_http_responses_total{backend="app",code="5xx",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="5xx",server="app4"} 0
haproxy_server_http_responses_total{backend="app",code="other",server="app1"} 0
haproxy_server_http_responses_total{backend="app",code="other",server="app2"} 0
haproxy_server_http_responses_total{backend="app",code="other",server="app3"} 0
haproxy_server_http_responses_total{backend="app",code="other",server="app4"} 0
haproxy_server_http_responses_total{backend="static",code="1xx",server="static"} 0
haproxy_server_http_responses_total{backend="static",code="2xx",server="static"} 0
haproxy_server_http_responses_total{backend="static",code="3xx",server="static"} 0
haproxy_server_http_responses_total{backend="static",code="4xx",server="static"} 0
haproxy_server_http_responses_total{backend="static",code="5xx",server="static"} 0
haproxy_server_http_responses_total{backend="static",code="other",server="static"} 0
# HELP haproxy_server_max_queue Maximum observed number of queued requests assigned to this server.
# TYPE haproxy_server_max_queue gauge
haproxy_server_max_queue{backend="app",server="app1"} 0
haproxy_server_max_queue{backend="app",server="app2"} 0
haproxy_server_max_queue{backend="app",server="app3"} 0
haproxy_server_max_queue{backend="app",server="app4"} 0
haproxy_server_max_queue{backend="static",server="static"} 0
# HELP haproxy_server_max_session_rate Maximum observed number of sessions per second.
# TYPE haproxy_server_max_session_rate gauge
haproxy_server_max_session_rate{backend="app",server="app1"} 1
haproxy_server_max_session_rate{backend="app",server="app2"} 1
haproxy_server_max_session_rate{backend="app",server="app3"} 0
haproxy_server_max_session_rate{backend="app",server="app4"} 0
haproxy_server_max_session_rate{backend="static",server="static"} 0
# HELP haproxy_server_max_sessions Maximum observed number of active sessions.
# TYPE haproxy_server_max_sessions gauge
haproxy_server_max_sessions{backend="app",server="app1"} 1
haproxy_server_max_sessions{backend="app",server="app2"} 1
haproxy_server_max_sessions{backend="app",server="app3"} 0
haproxy_server_max_sessions{backend="app",server="app4"} 0
haproxy_server_max_sessions{backend="static",server="static"} 0
# HELP haproxy_server_redispatch_warnings_total Total of redispatch warnings.
# TYPE haproxy_server_redispatch_warnings_total gauge
haproxy_server_redispatch_warnings_total{backend="app",server="app1"} 0
haproxy_server_redispatch_warnings_total{backend="app",server="app2"} 0
haproxy_server_redispatch_warnings_total{backend="app",server="app3"} 0
haproxy_server_redispatch_warnings_total{backend="app",server="app4"} 0
haproxy_server_redispatch_warnings_total{backend="static",server="static"} 0
# HELP haproxy_server_response_errors_total Total of response errors.
# TYPE haproxy_server_response_errors_total gauge
haproxy_server_response_errors_total{backend="app",server="app1"} 0
haproxy_server_response_errors_total{backend="app",server="app2"} 0
haproxy_server_response_errors_total{backend="app",server="app3"} 0
haproxy_server_response_errors_total{backend="app",server="app4"} 0
haproxy_server_response_errors_total{backend="static",server="static"} 0
# HELP haproxy_server_retry_warnings_total Total of retry warnings.
# TYPE haproxy_server_retry_warnings_total gauge
haproxy_server_retry_warnings_total{backend="app",server="app1"} 0
haproxy_server_retry_warnings_total{backend="app",server="app2"} 0
haproxy_server_retry_warnings_total{backend="app",server="app3"} 0
haproxy_server_retry_warnings_total{backend="app",server="app4"} 0
haproxy_server_retry_warnings_total{backend="static",server="static"} 0
# HELP haproxy_server_server_selected_total Total number of times a server was selected, either for new sessions, or when re-dispatching.
# TYPE haproxy_server_server_selected_total gauge
haproxy_server_server_selected_total{backend="app",server="app1"} 3
haproxy_server_server_selected_total{backend="app",server="app2"} 2
haproxy_server_server_selected_total{backend="app",server="app3"} 0
haproxy_server_server_selected_total{backend="app",server="app4"} 0
haproxy_server_server_selected_total{backend="static",server="static"} 0
# HELP haproxy_server_sessions_total Total number of sessions.
# TYPE haproxy_server_sessions_total gauge
haproxy_server_sessions_total{backend="app",server="app1"} 3
haproxy_server_sessions_total{backend="app",server="app2"} 2
haproxy_server_sessions_total{backend="app",server="app3"} 0
haproxy_server_sessions_total{backend="app",server="app4"} 0
haproxy_server_sessions_total{backend="static",server="static"} 0
# HELP haproxy_server_up Current health status of the server (1 = UP, 0 = DOWN).
# TYPE haproxy_server_up gauge
haproxy_server_up{backend="app",server="app1"} 1
haproxy_server_up{backend="app",server="app2"} 1
haproxy_server_up{backend="app",server="app3"} 0
haproxy_server_up{backend="app",server="app4"} 0
haproxy_server_up{backend="static",server="static"} 0
# HELP haproxy_server_weight Current weight of the server.
# TYPE haproxy_server_weight gauge
haproxy_server_weight{backend="app",server="app1"} 1
haproxy_server_weight{backend="app",server="app2"} 1
haproxy_server_weight{backend="app",server="app3"} 1
haproxy_server_weight{backend="app",server="app4"} 1
haproxy_server_weight{backend="static",server="static"} 1
# HELP haproxy_up Was the last scrape of haproxy successful.
# TYPE haproxy_up gauge
haproxy_up 1
来源:CSDN
作者:xiaojinran
链接:https://blog.csdn.net/xiaojinran/article/details/103766551