数据采集 采集源配置 HAProxy 性能指标采集
HAProxy 性能指标采集
简介
使用 HAProxy 服务器的 stats socket 或 HTTP 统计页面采集数据上报到 DataFlux 中
前置条件
- 已安装 DataKit(DataKit 安装文档)
HAProxy 配置
stats enable 选项可用于添加不进行身份验证的http访问。要启用 unix socket,首先要读取 stats socket 选项。
配置
进入 DataKit 安装目录下的 conf.d/haproxy 目录,复制 haproxy.conf.sample 并命名为 haproxy.conf。示例如下:
# Read metrics of HAProxy, via socket or HTTP stats page
[[inputs.haproxy]]
## An array of address to gather stats about. Specify an ip on hostname
## with optional port. ie localhost, 10.10.3.33:1936, etc.
## Make sure you specify the complete path to the stats endpoint
## including the protocol, ie http://10.10.3.33:1936/haproxy?stats
## If no servers are specified, then default to 127.0.0.1:1936/haproxy?stats
servers = ["http://myhaproxy.com:1936/haproxy?stats"]
## You can also use local socket with standard wildcard globbing.
## Server address not starting with 'http' will be treated as a possible
## socket, so both examples below are valid.
# servers = ["socket:/run/haproxy/admin.sock", "/run/haproxy/*.sock"]
## By default, some of the fields are renamed from what haproxy calls them.
## Setting this option to true results in the plugin keeping the original
## field names.
# keep_field_names = false
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
配置好后,重启 DataKit 即可生效
指标集 haproxy
tags
名称 | 描述 |
---|---|
proxy | proxy name |
server | address of the server data was gathered from |
sv | service name |
type | proxy session type |
fields
名称 | 描述 | 类型 |
---|---|---|
active_servers | int | |
backup_servers | int | |
bin | int | |
bout | int | |
cache_hits | int | |
cache_lookups | int | |
chkdown | int | |
cli_abort | int | |
comp_byp | int | |
comp_in | int | |
comp_out | int | |
comp_rsp | int | |
conn_rate | int | |
conn_rate_max | int | |
conn_tot | int | |
connect | int | |
ctime | int | |
ctime_max | int | |
dcon | int | |
downtime | int | |
dreq | int | |
dresp | int | |
dses | int | |
econ | int | |
eint | int | |
ereq | int | |
eresp | int | |
http_response.1xx | int | |
http_response.2xx | int | |
http_response.3xx | int | |
http_response.4xx | int | |
http_response.5xx | int | |
http_response.other | int | |
idle_conn_cur | int | |
iid | int | |
intercepted | int | |
lastchg | int | |
lastsess | int | |
lbtot | int | |
mode | str | |
need_conn_est | int | |
pid | int | |
qcur | int | |
qmax | int | |
qtime | int | |
qtime_max | int | |
rate | int | |
rate_lim | int | |
rate_max | int | |
req_rate | int | |
req_rate_max | int | |
req_tot | int | |
reuse | int | |
rtime | int | |
rtime_max | int | |
safe_conn_cur | int | |
scur | int | |
sid | int | |
slim | int | |
smax | int | |
srv_abort | int | |
srv_icur | int | |
status | str | |
stot | int | |
ttime | int | |
ttime_max | int | |
used_conn_cur | int | |
weight | int | |
wredis | int | |
wretr | int | |
wrew | int |