数据采集 采集源配置 lighttpd 监控指标采集
lighttpd 监控指标采集
简介
采集 lighttpd 数据指标上报到 DataFlux 中。
前置条件
- 已安装 lighttpd (v1.x版本安装链接 v2.x版本安装链接)
- 已安装 DataKit(DataKit 安装文档)
配置
lighttpd 配置
lighttpd 需要开启 server-status 功能,v1 和 v2 版本的开启方式略有不同。修改 lighttpd.conf 配置文件:
- lighttpd v1.x.x 版本,lighttpd 开启 status 官方文档
# 启动 status 模块
server.modules = ( ..., "mod_status", ... )
# 配置 status 路由
status.status-url = "/server-status"
- lighttpd v2.x.x 版本,lighttpd2 开启 status 官方文档
setup {
module_load ["mod_status"];
}
if req.path == "/server-status" {
status.info;
}
DataKit 配置
进入 DataKit 安装目录下的 conf.d/lighttpd
目录,复制 lighttpd.conf.sample
并命名为 lighttpd.conf
。示例如下:
[[inputs.lighttpd]]
# lighttpd status url,通常只需要修改 ip 和 端口
# 必填
url = "http://127.0.0.1:8080/server-status"
# 指定 lighttpd 版本为 "v1" 或 "v2"
# 必填
version = "v1"
# 采集间隔时长,数字+单位,有效的时间单位 "ns", "us" (or "µs"), "ms", "s", "m", "h"
# 不可以小于等于 0
# 必填
interval = "10s"
# 自定义 tags,建议配置以区分数据来源
# [inputs.lighttpd.tags]
# from = 127.0.0.1:8080
# version = "v1"
采集指标
v1.x.x 版本指标说明
指标 | 描述 | 类型 | 单位 |
---|---|---|---|
BusyServers | 活跃的连接数。 | int | Shown as connection |
IdleServers | 空闲的连接数。 | int | Shown as connection |
RequestAverage5s | 最近5秒内,平均每秒接收到请求数。 | int | Shown as request |
RequestsTotal | 程序运行至今,已命中的请求数。 | int | Shown as hit |
TrafficAverage5s | 最近5秒内,平均每秒发送和接收的字节数。 | int | Shown as byte |
TrafficTotal | 程序运行至今,发送和接收的字节数。 | int | Shown as byte |
Uptime | 程序已经运行的时间。 | int | Shown as second |
v2.x.x 版本指标说明
指标 | 描述 | 类型 | 单位 |
---|---|---|---|
ConnectionStateHandleRequest | 正在处理request的连接数。 | int | Shown as connection |
ConnectionStateKeepAlive | 长连接数。 | int | Shown as connection |
ConnectionStateReadHeader | 读取reqeust的连接数。 | int | Shown as connection |
ConnectionStateStart | 开始连接的连接数。 | int | Shown as connection |
ConnectionStateUpgraded | int | Shown as connection | |
ConnectionStateWriteResponse | 正在写入response的连接数。 | int | Shown as connection |
ConnectionsAbs | 连接数。 | int | Shown as connection |
ConnectionsAvg | 程序运行至今,平均每秒收到连接数。 | int | Shown as connection |
ConnectionsAvg5sec | 最近5秒内,平均每秒接收到连接数。 | int | Shown as connection |
MemoryUsage | 程序已使用的内存。 | int | Shown as byte |
RequestsAbs | 接收到的请求数。 | int | Shown as request |
RequestsAvg | 程序运行至今,平均每秒接收的请求数。 | int | Shown as request |
RequestsAvg5sec | 最近5秒内,平均每秒接收的请求数。 | int | Shown as request |
Status1xx | response返回码为1xx的数量。 | int | Shown as response |
Status2xx | response返回码为2xx的数量。 | int | Shown as response |
Status3xx | response返回码为3xx的数量。 | int | Shown as response |
Status4xx | response返回码为4xx的数量。 | int | Shown as response |
Status5xx | response返回码为5xx的数量。 | int | Shown as response |
TrafficInAbs | 接收的字节数。 | int | Shown as byte |
TrafficInAvg | 程序运行至今,平均每秒接收的字节数。 | int | Shown as byte |
TrafficInAvg5sec | 最近5秒内,平均每秒接收的字节数。 | int | Shown as byte |
TrafficOutAbs | 每秒发送的字节数。 | int | Shown as byte |
TrafficOutAvg | 程序运行至今,平均每秒发送的字节数。 | int | Shown as byte |
TrafficOutAvg5sec | 最近5秒内,平均每秒发送的字节数。 | int | Shown as byte |
Uptime | 程序已经运行的时间。 | int | Shown as second |