Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrReporterRequired = &AgentError{message: "reporter function is required"}
ErrReporterRequired 错误:未提供上报函数
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent 通用采集器,定期采集本机信息并执行上报流程
func NewAgent ¶
NewAgent 创建新的Agent实例 如果未提供 Collector,将使用默认的 monitor.CollectStats Reporter 是必需的,如果未提供,将返回错误
type AgentError ¶
type AgentError struct {
// contains filtered or unexported fields
}
AgentError Agent相关错误
func (*AgentError) Error ¶
func (e *AgentError) Error() string
type ClientInfo ¶
type ClientInfo struct {
Hostname string `redis:"hostname"`
LastReportAt time.Time `redis:"last_report_at"`
CpuPercent float64 `redis:"cpu_percent"`
MemPercent float64 `redis:"mem_percent"`
DiskPercent float64 `redis:"disk_percent"`
NetBytesSent float64 `redis:"net_bytes_sent"`
NetBytesRec float64 `redis:"net_bytes_rec"`
Version string `redis:"version"`
}
ClientInfo 客户端信息结构,用于Redis存储
type Option ¶
type Option func(*Agent)
Option 配置选项函数类型
func WithCollector ¶
func WithCollector(collector func() (*monitor.SystemStats, error)) Option
WithCollector 设置自定义数据收集函数 如果不设置,将使用默认的 monitor.CollectStats
func WithReporter ¶
func WithReporter(reporter func(*monitor.SystemStats) error) Option
WithReporter 设置数据上报函数 这是必需的选项,如果不设置,Agent 将无法上报数据
Click to show internal directories.
Click to hide internal directories.