1.什么是HaTop
HATop 是一个交互式的基于 ncurses 开发的实时监控HAProxy负载均衡系统的统计工具。后来有人对该工具进行改进,增加了 TCP 支持
2.安装部署
在安装之前需要开启haproxy的sock
修改
/etc/haproxy/haproxy.cfg文件中的global部分,添加
stats socket /tmp/haproxy.sock
下载安装包
cd /usr/local/src/
wget https://github.com/Wirehive/hatop/archive/master.zip
安装
unzip master.zip
cd hatop-master/
install -m 755 bin/hatop /usr/local/bin
install -m 644 man/hatop.1 /usr/local/share/man/man1
gzip /usr/local/share/man/man1/hatop.1
以上可以直接复制黏贴就可以实现了,具体的参数在hatop-master/README 可以了解到
3.HaTop使用
hatop -s /tmp/haproxy.sock
按q键退出,运行界面分为5大块 (界面切换分别按 1 2 3 4 5 来选择)
很多参数在上面的hatop-master/README 文件中可以了解的,界面也很清晰的告诉我们多少个机器是OK的
In STATUS mode
--------------
::
ACT server is active (server), number of active servers (backend) 存货机器
BCK server is backup (server), number of backup servers (backend) 备份机器
QCUR current queued requests 当前队列请求
QMAX max queued requests 最大队列请求
SCUR current sessions 当前会话
SMAX max sessions 最大会话
SLIM sessions limit 会话限制
STOT total sessions 总会话数
In TRAFFIC mode
---------------
::
LBTOT total number of times a server was selected 每个服务器被选中的次数
RATE number of sessions per second over last elapsed second 过去一秒的会话运行次数
RLIM limit on new sessions per second 在每秒新建会话限制
RMAX max number of new sessions per second 每秒最大连接数
BIN bytes in (IEEE 1541-2002)
BOUT bytes out (IEEE 1541-2002)
In HTTP mode
------------
::
RATE HTTP requests per second over last elapsed second 过去1妙http请求
RMAX max number of HTTP requests per second observed
RTOT total number of HTTP requests received
1xx number of HTTP responses with 1xx code
2xx number of HTTP responses with 2xx code
3xx number of HTTP responses with 3xx code
4xx number of HTTP responses with 4xx code
5xx number of HTTP responses with 5xx code
?xx number of HTTP responses with other codes (protocol error)
In ERRORS mode
--------------
::
CF number of failed checks
CD number of UP->DOWN transitions
CL last status change
ECONN connection errors
EREQ request errors
ERSP response errors
DREQ denied requests
DRSP denied responses
DOWN total downtime
Health check status reference
=============================
::
UNK unknown
INI initializing
SOCKERR socket error
L4OK check passed on layer 4, no upper layers testing enabled
L4TMOUT layer 1-4 timeout
L4CON layer 1-4 connection problem, for example
"Connection refused" (tcp rst) or "No route to host" (icmp)
L6OK check passed on layer 6
L6TOUT layer 6 (SSL) timeout
L6RSP layer 6 invalid response - protocol error
L7OK check passed on layer 7
L7OKC check conditionally passed on layer 7, for example 404 with
disable-on-404
L7TOUT layer 7 (HTTP/SMTP) timeout
L7RSP layer 7 invalid response - protocol error
L7STS layer 7 response error, for example HTTP 5xx