agent

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package agent provides mTLS-secured remote monitoring and management functionality.

Package agent provides a remote monitoring agent with mTLS security for the FIRE benchmarking tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUInfo

type CPUInfo struct {
	PhysicalCores int       `json:"physical_cores"`
	LogicalCores  int       `json:"logical_cores"`
	ModelName     string    `json:"model_name"`
	Usage         []float64 `json:"usage_percent"`
	Frequency     []float64 `json:"frequency_mhz"`
}

CPUInfo contains CPU information

type Client

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

Client represents an agent client

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

NewClient creates a new agent client

func (*Client) CheckHealth

func (c *Client) CheckHealth() error

CheckHealth checks if the agent is healthy

func (*Client) Connect

func (c *Client) Connect() ([]byte, error)

Connect connects to the specified endpoint and returns the response

type ClientConfig

type ClientConfig struct {
	Host     string // Target host
	Port     int    // Target port
	CertFile string // Client certificate file
	KeyFile  string // Client private key file
	CAFile   string // CA certificate file for server verification
	Endpoint string // Endpoint to connect to
}

ClientConfig contains configuration for the agent client

func DefaultClientConfig

func DefaultClientConfig() ClientConfig

DefaultClientConfig returns default client configuration

func (*ClientConfig) LoadClientTLSConfig

func (c *ClientConfig) LoadClientTLSConfig() (*tls.Config, error)

LoadClientTLSConfig creates TLS configuration for the client

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

Validate checks if the client configuration is valid

type Config

type Config struct {
	Port     int    // Server port
	CertFile string // Server certificate file
	KeyFile  string // Server private key file
	CAFile   string // CA certificate file for client verification
	LogFile  string // Optional log file path
}

Config contains configuration for the agent server

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default agent configuration

func (Config) LoadTLSConfig

func (c Config) LoadTLSConfig() (*tls.Config, error)

LoadTLSConfig creates TLS configuration from the agent config

func (Config) Validate

func (c Config) Validate() error

Validate checks if the configuration is valid

type DiskInfo

type DiskInfo struct {
	Path        string  `json:"path"`
	Fstype      string  `json:"fstype"`
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"used_percent"`
}

DiskInfo contains disk information

type FanInfo

type FanInfo struct {
	Name  string `json:"name"`
	Speed int    `json:"speed_rpm"`
}

FanInfo contains fan sensor data

type GPUInfo

type GPUInfo struct {
	Index       int     `json:"index"`
	Name        string  `json:"name"`
	Temperature float64 `json:"temperature_c"`
	MemoryUsed  uint64  `json:"memory_used"`
	MemoryTotal uint64  `json:"memory_total"`
	Utilization int     `json:"utilization_percent"`
	FanSpeed    int     `json:"fan_speed_percent"`
}

GPUInfo contains GPU sensor data

type HostInfo

type HostInfo struct {
	Hostname        string `json:"hostname"`
	Uptime          uint64 `json:"uptime"`
	BootTime        uint64 `json:"boot_time"`
	OS              string `json:"os"`
	Platform        string `json:"platform"`
	PlatformVersion string `json:"platform_version"`
	KernelVersion   string `json:"kernel_version"`
	Architecture    string `json:"architecture"`
}

HostInfo contains host information

type LogsResponse

type LogsResponse struct {
	Lines     []string  `json:"lines"`
	File      string    `json:"file"`
	Timestamp time.Time `json:"timestamp"`
}

LogsResponse contains log data

type MemoryInfo

type MemoryInfo struct {
	Total       uint64  `json:"total"`
	Available   uint64  `json:"available"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"used_percent"`
	Free        uint64  `json:"free"`
}

MemoryInfo contains memory information

type NetworkInfo

type NetworkInfo struct {
	Name        string `json:"name"`
	BytesSent   uint64 `json:"bytes_sent"`
	BytesRecv   uint64 `json:"bytes_recv"`
	PacketsSent uint64 `json:"packets_sent"`
	PacketsRecv uint64 `json:"packets_recv"`
}

NetworkInfo contains network interface information

type SensorsInfo

type SensorsInfo struct {
	Timestamp   time.Time         `json:"timestamp"`
	Temperature []TemperatureInfo `json:"temperature"`
	Fans        []FanInfo         `json:"fans"`
	GPU         []GPUInfo         `json:"gpu,omitempty"`
}

SensorsInfo contains sensor data

type Server

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

Server represents the agent server

func NewServer

func NewServer(config Config) (*Server, error)

NewServer creates a new agent server

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server

func (*Server) Start

func (s *Server) Start() error

Start starts the agent server

type SysInfo

type SysInfo struct {
	Timestamp time.Time     `json:"timestamp"`
	Host      HostInfo      `json:"host"`
	CPU       CPUInfo       `json:"cpu"`
	Memory    MemoryInfo    `json:"memory"`
	Disk      []DiskInfo    `json:"disk"`
	Network   []NetworkInfo `json:"network"`
}

SysInfo contains system information

type TemperatureInfo

type TemperatureInfo struct {
	Name        string  `json:"name"`
	Temperature float64 `json:"temperature_c"`
	Critical    float64 `json:"critical_c,omitempty"`
}

TemperatureInfo contains temperature sensor data

Jump to

Keyboard shortcuts

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