Documentation
¶
Overview ¶
Package collector 采集节点系统信息(Linux /proc,零外部依赖)。 生产 Agent 部署在 Linux systemd 环境,无需跨平台。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector 通过 /proc 采集。
func (*Collector) RealtimeSnapshot ¶ added in v0.3.1
RealtimeSnapshot 采集实时差分指标(CPU 为自上次调用以来的均值,网速结合瞬时/峰值防稀释), 并附带绝对值类指标。它是 CPU 与网速差分基线**唯一**的写入方。
func (*Collector) SystemSnapshot ¶ added in v0.3.1
SystemSnapshot 只采集绝对值类指标(内存 / 磁盘 / 连接数),不碰任何差分基线。
快车道(metrics_split)模式下心跳走这里:CPU 与网速的差分基线只允许 RealtimeSnapshot 一个写入方。两个循环共用一个基线时,后到的一方窗口被压缩到 亚毫秒,量化误差会产出 100% / 0% 的伪值(见 minDeltaWindow)。
type Snapshot ¶
type Snapshot struct {
CPU float64 // 百分比(自上次采集以来的均值)
Mem float64 // 已用内存(字节)
MemTotal float64 // 总内存(字节)
Disk float64 // 已用磁盘(字节)
DiskTotal float64 // 总磁盘(字节)
RxBytes uint64 // 物理网卡接收总字节
TxBytes uint64 // 物理网卡发送总字节
RxRate float64 // 入口带宽速率(字节/秒)
TxRate float64 // 出口带宽速率(字节/秒)
// 连接数(整机口径,读内核连接表;非 Linux 平台 ConnOK=false 表示不支持)
ConnTCPEstablished int // TCP 已建立连接数
ConnTCPTotal int // TCP 表项总数(不含 LISTEN,含 TIME_WAIT 等残留)
ConnUDP int // UDP 绑定 socket 数(不是会话数)
ConnOK bool // 本平台是否支持采集连接数
}
Snapshot 一次采集结果。
Click to show internal directories.
Click to hide internal directories.