collector

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

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 New

func New() *Collector

New 构造采集器。

func (*Collector) Close added in v0.1.18

func (c *Collector) Close()

Close 停止后台高频采样。

func (*Collector) Snapshot

func (c *Collector) Snapshot() Snapshot

Snapshot 采集当前快照(CPU 为自上次调用以来的均值,网速结合瞬时/峰值防稀释)。

type Snapshot

type Snapshot struct {
	CPU       float64 // 百分比(自上次采集以来的均值)
	Mem       float64 // 已用内存(字节)
	MemTotal  float64 // 总内存(字节)
	Disk      float64 // 已用磁盘(字节)
	DiskTotal float64 // 总磁盘(字节)
	RxBytes   uint64  // 物理网卡接收总字节
	TxBytes   uint64  // 物理网卡发送总字节
	RxRate    float64 // 入口带宽速率(字节/秒)
	TxRate    float64 // 出口带宽速率(字节/秒)
}

Snapshot 一次采集结果。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL