HAProxy监控页面指标含义

本文介绍了如何访问HAProxy的监控页面,并详细解析了各项监控指标的含义,如pxname(代理名)、svname(服务名)、qcur(当前排队请求)、status(状态)等。了解这些指标有助于更好地管理和优化HAProxy的负载均衡配置。同时提到了通过命令行工具socat获取相同信息的方法。
摘要由CSDN通过智能技术生成

一、概述

使用HA后在配置文件里边配置了监控页面信息后,可以在浏览器中访问地址去看到。

#haproxy监控页面地址
listen  admin_stat
        #haproxy的web管理端口 8888,自行设置
        bind 0.0.0.0:8888
        mode    http
        stats   refresh 30s
        #haproxy web管理url,自行设置
        stats uri /haproxy_stats
        stats realm Haproxy\ Statistics
        #haproxy web管理用户名密码,自行设置
        stats auth admin:admin
        stats hide-version

浏览器访问

http://192.168.1.1:8888/haproxy_stats

在这里插入图片描述
浏览器访问

http://192.168.1.1:8888/haproxy_stats;csv
# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,
main,FRONTEND,,,0,0,8000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,2,0,,,,0,0,0,0,,,,0,0,0,0,0,0,,0,0,0,,,0,0,0,0,,,,,,,,
static,static,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,6046,6046,,1,3,1,,0,,2,0,,0,L4CON,,0,0,0,0,0,0,0,0,,,,0,0,,,,,-1,Connection refused,,0,0,0,0,
static,BACKEND,0,0,0,0,800,0,0,0,0,0,,0,0,0,0,DOWN,0,0,0,,1,6046,6046,,1,3,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,0,0,0,0,-1,,,0,0,0,0,
app,app1,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,6046,6046,,1,4,1,,0,,2,0,,0,L4CON,,0,0,0,0,0,0,0,0,,,,0,0,,,,,-1,Connection refused,,0,0,0,0,
app,app2,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,6046,6046,,1,4,2,,0,,2,0,,0,L4CON,,0,0,0,0,0,0,0,0,,,,0,0,,,,,-1,Connection refused,,0,0,0,0,
app,app3,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,6046,6046,,1,4,3,,0,,2,0,,0,L4CON,,0,0,0,0,0,0,0,0,,,,0,0,,,,,-1,Connection refused,,0,0,0,0,
app,app4,0,0,0,0,,0,0,0,,0,,0,0,0,0,DOWN,1,1,0,1,1,6045,6045,,1,4,4,,0,,2,0,,0,L4CON,,0,0,0,0,0,0,0,0,,,,0,0,,,,,-1,Connection refused,,0,0,0,0,
app,BACKEND,0,0,0,0,800,0,0,0,0,0,,0,0,0,0,DOWN,0,0,0,,1,6045,6045,,1,4,0,,0,,1,0,,0,,,,0,0,0,0,0,0,,,,,0,0,0,0,0,0,-1,,,0,0,0,0,
T-MQ,FRONTEND,,,0,0,8000,0,0,0,0,0,0,,,,,OPEN,,,,,,,,,1,5,0,,,,0,0,0,0,,,,,,,,,,,0,0,0,,,0,0,0,0,,,,,,,,
T-MQ,node01,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,0,0,6046,0,,1,5,1,,0,,2,0,,0,L4OK,,0,,,,,,,0,,,,0,0,,,,,-1,,,0,0,0,0,
T-MQ,node02,0,0,0,0,,0,0,0,,0,,0,0,0,0,UP,1,1,0,3,1,1106,4,,1,5,2,,0,,2,0,,0,L4OK,,0,,,,,,,0,,,,0,0,,,,,-1,,,0,0,0,0,
T-MQ,BACKEND,0,0,0,0,800,0,0,0,0,0,,0,0,0,0,UP,2,2,0,,0,6046,0,,1,5,0,,0,,1,0,,0,,,,,,,,,,,,,,0,0,0,0,0,0,-1,,,0,0,0,0,
MAB1_MQ_ClusterMgr,FRONTEND,,,0,1,8000,48,11904,14688,0,0,0,,,,,OPEN,,,,,,,,,1,6,0,,,,0,0,0,1,,,,0,0,0,48,0,0,,0,1,48,,,0,0,0,0,,,,,,,,
MAB1_MQ_ClusterMgr,node01,0,0,0,1,,24,5952,7344,,0,,0,0,0,0,UP,1,1,0,0,0,6046,0,,1,6,1,,24,,2,0,,1,L4OK,,0,0,0,0,24,0,0,0,,,,0,0,,,,,434,,,0,0,1,1,
MAB1_MQ_ClusterMgr,node02,0,0,0,1,,24,5952,7344,,0,,0,0,0,0,UP,1,1,0,3,1,1106,4,,1,6,2,,24,,2,0,,1,L4OK,,0,0,0,0,24,0,0,0,,,,0,0,,,,,374,,,0,1,1,1,
MAB1_MQ_ClusterMgr,BACKEND,0,0,0,1,800,48,11904,14688,0,0,,0,0,0,0,UP,2,2,0,,0,6046,0,,1,6,0,,48,,1,0,,1,,,,0,0,0,48,0,0,,,,,0,0,0,0,0,0,374,,,0,1,1,2,
admin_stat,FRONTEND,,,1,3,8000,40,758757,14812275,0,0,6,,,,,OPEN,,,,,,,,,1,7,0,,,,0,1,0,2,,,,0,4804,0,9,11,0,,1,3,4825,,,0,0,0,0,,,,,,,,
admin_stat,BACKEND,0,0,0,1,800,11,758757,14812275,0,0,,11,0,0,0,UP,0,0,0,,0,6046,0,,1,7,0,,0,,1,0,,2,,,,0,0,0,0,11,0,,,,,0,0,0,0,0,0,0,,,0,0,1,968,

除了上边这种方法还可以通过echo "show stat" | socat /var/lib/haproxy/stats stdio这条命令来看到上边的输出信息

这些指标具体是什么含义,了解这些指标之后,我相信对HA的理解会更进一步。

二、指标含义

指标含义
pxnameproxy的名字
svnameservice name (FRONTEND for frontend, BACKEND for backend, any name for server)
qcur当前排队的请求
qmax最大排队请求
scur当前的会话个数
smax最大的会话个数
slim会话限制
stot会话总数
bin输入的字节
bout输出的字节
dreq被拒绝的请求数量
dresp被拒绝的答复数量
ereq请求错误的数量
econ连接错误
eresp响应错误(其中srv_abrt)
wretr重试(警告)
wredis重新分派(警告)
status状态(UP / DOWN / NOLB / MAINT / MAINT(通过)…)
weight服务器重量(服务器),总重量(后端)
act服务器是活动的(服务器),活动服务器的数量(后端)
bck服务器是备份(服务器),备份服务器数量(后端)
chkfail检查失败的次数
chkdownUP-> DOWN转换次数
lastchg上次状态变化(以秒为单位)
downtime总停机时间(以秒为单位)
qlimit队列限制
pid进程id
iid唯一代理id
sid服务ID
throttle预热状态
lbtot选择服务器的总次数
tracked如果启用了跟踪,则代理/服务器的ID
type(0 =前端,1 =后端,2 =服务器,3 =套接字)
rate上一次经过的每秒会话数
rate_lim每秒新会话的限制
rate_max每秒新会话的最大数量
check_status上次健康检查的状态,其中一个:UNK - >未知 INI - >初始化 SOCKERR - >套接字错误 L4OK - >检查在第4层上传递,没有启用上层测试L4TMOUT - > 1-4层超时 例如,L4CON - > 1-4层连接问题 “拒绝连接”(tcp rst)或“无主机路由”(icmp) L6OK - >检查在第6层传递 L6TOUT - >第6层(SSL)超时 L6RSP - >第6层无效响应 - 协议错误 L7OK - >检查在第7层传递 L7OKC - >有条不紊地检查第7层,例如404 禁用-ON-404 L7TOUT - >第7层(HTTP / SMTP)超时 L7RSP - >第7层无效响应 - 协议错误 L7STS - >第7层响应错误,例如HTTP 5xx
check_codelayer5-7代码,如果可用的话
check_duration完成上次健康检查所需的时间(毫秒)
hrsp_1xx带有1xx代码的http响应
hrsp_2xx带有2xx代码的http响应
hrsp_other与其他代码的http响应(协议错误)
hanafail健康检查细节失败
req_rate在过去的第二个秒内每秒的HTTP请求数
req_rate_max观察到的每秒最大HTTP请求数
req_tot收到的HTTP请求总数
cli_abrt客户端中止的数据传输次数
srv_abrt服务器中止的数据传输次数(包括在eresp中)

三、引用

https://blog.csdn.net/qq_34355232/article/details/82589619
https://www.cnblogs.com/MYSQLZOUQI/p/5809267.html

一个典型的Haproxy_exporter的监控metric例子 包含指标 haproxy_backend_bytes_in_total haproxy_backend_bytes_out_total haproxy_backend_client_aborts_total haproxy_backend_compressor_bytes_bypassed_total haproxy_backend_compressor_bytes_in_total haproxy_backend_compressor_bytes_out_total haproxy_backend_connection_errors_total haproxy_backend_current_queue haproxy_backend_current_server haproxy_backend_current_session_rate haproxy_backend_current_sessions haproxy_backend_http_connect_time_average_seconds haproxy_backend_http_queue_time_average_seconds haproxy_backend_http_response_time_average_seconds haproxy_backend_http_responses_compressed_total haproxy_backend_http_responses_total haproxy_backend_http_total_time_average_seconds haproxy_backend_response_errors_total haproxy_backend_retry_warnings_total haproxy_backend_server_aborts_total haproxy_backend_server_selected_total haproxy_backend_sessions_total haproxy_backend_up haproxy_backend_weight haproxy_exporter_build_info haproxy_exporter_csv_parse_failures haproxy_exporter_total_scrapes haproxy_frontend_bytes_in_total haproxy_frontend_bytes_out_total haproxy_frontend_compressor_bytes_bypassed_total haproxy_frontend_compressor_bytes_in_total haproxy_frontend_compressor_bytes_out_total haproxy_frontend_connections_total haproxy_frontend_current_session_rate haproxy_frontend_current_sessions haproxy_frontend_http_requests_total haproxy_frontend_http_responses_compressed_total haproxy_frontend_http_responses_total haproxy_frontend_limit_session_rate haproxy_frontend_limit_sessions haproxy_frontend_max_session_rate haproxy_frontend_max_sessions haproxy_frontend_request_errors_total haproxy_frontend_requests_denied_total haproxy_frontend_sessions_total haproxy_server_bytes_in_total haproxy_server_bytes_out_total haproxy_server_check_duration_seconds haproxy_server_check_failures_total haproxy_server_client_aborts_total haproxy_server_connection_errors_total haproxy_server_current_queue haproxy_server_current_session_rate haproxy_server_current_sessions haproxy_server_downtime_seconds_total haproxy_server_http_responses_total haproxy_server_max_queue haproxy_server_max_session_rate haproxy_server_max_sessions haproxy_server_redispatch_warnings_total haproxy_server_response_errors_total haproxy_server_retry_warnings_total haproxy_server_server_aborts_total haproxy_server_server_selected_total haproxy_server_sessions_total haproxy_server_up haproxy_server_weight haproxy_up process_cpu_seconds_total process_max_fds process_open_fds process_resident_memory_bytes process_start_time_seconds process_virtual_memory_bytes promhttp_metric_handler_requests_in_flight promhttp_metric_handler_requests_total
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Energet!c

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值