agent

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: GPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent represents the monitor SSE agent

func New

func New(cfg *config.AgentConfig) *Agent

New creates a new Agent instance

func NewWithTailscale

func NewWithTailscale(cfg *config.AgentConfig, tsCfg *config.TailscaleConfig) *Agent

NewWithTailscale creates a new Agent instance with Tailscale support

func (*Agent) GetTailscaleStatus

func (a *Agent) GetTailscaleStatus() (map[string]any, error)

GetTailscaleStatus returns the current Tailscale connection status

func (*Agent) Start

func (a *Agent) Start(ctx context.Context) error

Start starts the agent server

type CPUStats

type CPUStats struct {
	UsagePercent float64   `json:"usage_percent"`
	Cores        int       `json:"cores"`
	Threads      int       `json:"threads"`
	Model        string    `json:"model"`
	Frequency    float64   `json:"frequency"`          // MHz
	LoadAvg      []float64 `json:"load_avg,omitempty"` // 1, 5, 15 min
}

CPUStats represents CPU usage statistics

type DiskStats

type DiskStats struct {
	Path        string  `json:"path"`
	Device      string  `json:"device"`
	Fstype      string  `json:"fstype"`
	Total       uint64  `json:"total"`
	Used        uint64  `json:"used"`
	Free        uint64  `json:"free"`
	UsedPercent float64 `json:"used_percent"`
	Model       string  `json:"model,omitempty"`  // Disk model name from SMART data
	Serial      string  `json:"serial,omitempty"` // Disk serial number from SMART data
}

DiskStats represents disk usage statistics

type HardwareStats

type HardwareStats struct {
	CPU         CPUStats           `json:"cpu"`
	Memory      MemoryStats        `json:"memory"`
	Disks       []DiskStats        `json:"disks"`
	Temperature []TemperatureStats `json:"temperature,omitempty"`
	UpdatedAt   time.Time          `json:"updated_at"`
}

HardwareStats represents system hardware statistics

type InterfaceInfo

type InterfaceInfo struct {
	Name       string `json:"name"`
	Alias      string `json:"alias"`
	IPAddress  string `json:"ip_address"`
	LinkSpeed  int    `json:"link_speed"` // Mbps
	IsUp       bool   `json:"is_up"`
	BytesTotal int64  `json:"bytes_total"`
}

InterfaceInfo represents network interface details

type MemoryStats

type MemoryStats struct {
	Total       uint64  `json:"total"`
	Used        uint64  `json:"used"`
	Free        uint64  `json:"free"`
	Available   uint64  `json:"available"`
	UsedPercent float64 `json:"used_percent"`
	Cached      uint64  `json:"cached"`
	Buffers     uint64  `json:"buffers"`
	ZFSArc      uint64  `json:"zfs_arc"`
	SwapTotal   uint64  `json:"swap_total"`
	SwapUsed    uint64  `json:"swap_used"`
	SwapPercent float64 `json:"swap_percent"`
}

MemoryStats represents memory usage statistics

type MonitorLiveData

type MonitorLiveData struct {
	Index   int `json:"index"`
	Seconds int `json:"seconds"`
	Rx      struct {
		Ratestring       string `json:"ratestring"`
		Bytespersecond   int    `json:"bytespersecond"`
		Packetspersecond int    `json:"packetspersecond"`
		Bytes            int    `json:"bytes"`
		Packets          int    `json:"packets"`
		Totalbytes       int    `json:"totalbytes"`
		Totalpackets     int    `json:"totalpackets"`
	} `json:"rx"`
	Tx struct {
		Ratestring       string `json:"ratestring"`
		Bytespersecond   int    `json:"bytespersecond"`
		Packetspersecond int    `json:"packetspersecond"`
		Bytes            int    `json:"bytes"`
		Packets          int    `json:"packets"`
		Totalbytes       int    `json:"totalbytes"`
		Totalpackets     int    `json:"totalpackets"`
	} `json:"tx"`
}

MonitorLiveData represents the JSON structure from vnstat --live --json

type PeakStats

type PeakStats struct {
	PeakRx          int       `json:"peak_rx"` // bytes/s
	PeakTx          int       `json:"peak_tx"` // bytes/s
	PeakRxString    string    `json:"peak_rx_string"`
	PeakTxString    string    `json:"peak_tx_string"`
	PeakRxTimestamp time.Time `json:"peak_rx_timestamp"`
	PeakTxTimestamp time.Time `json:"peak_tx_timestamp"`
	UpdatedAt       time.Time `json:"updated_at"`
}

PeakStats represents peak bandwidth statistics

type SystemInfo

type SystemInfo struct {
	Hostname      string                   `json:"hostname"`
	Kernel        string                   `json:"kernel"`
	Uptime        int64                    `json:"uptime"` // seconds
	Interfaces    map[string]InterfaceInfo `json:"interfaces"`
	VnstatVersion string                   `json:"vnstat_version"`
	UpdatedAt     time.Time                `json:"updated_at"`
}

SystemInfo represents system information

type TemperatureStats

type TemperatureStats struct {
	SensorKey   string  `json:"sensor_key"`
	Temperature float64 `json:"temperature"` // Celsius
	Label       string  `json:"label,omitempty"`
	Critical    float64 `json:"critical,omitempty"`
}

TemperatureStats represents temperature sensor data

Jump to

Keyboard shortcuts

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