Documentation
¶
Index ¶
- func NewRemoteStatsCollectorFromSFTP(sftpClient *sftp.Client, sampleDelta time.Duration) *remoteStatsCollector
- func NewRemoteStatsCollectorFromSSH(sshClient *ssh.Client, sampleDelta time.Duration) (*remoteStatsCollector, error)
- func NewRemoteStatsCollectorFromSSHConfig(serverAddress string, config *ssh.ClientConfig, sampleDelta time.Duration) (*remoteStatsCollector, error)
- func PrintSystemStats(stats *SystemStats)
- func SystemStatsToJSON(stats *SystemStats) map[string]any
- type CPUStat
- type RemoteStatsMonitor
- func NewRemoteStatsMonitorFromSFTP(sftpClient *sftp.Client, interval time.Duration, sampleDelta time.Duration, ...) *RemoteStatsMonitor
- func NewRemoteStatsMonitorFromSSH(sshClient *ssh.Client, interval time.Duration, sampleDelta time.Duration, ...) (*RemoteStatsMonitor, error)
- func NewRemoteStatsMonitorFromSSHConfig(serverAddress string, config *ssh.ClientConfig, interval time.Duration, ...) (*RemoteStatsMonitor, error)
- func (m *RemoteStatsMonitor) Close() error
- func (m *RemoteStatsMonitor) GetCurrentStats() (*SystemStats, error)
- func (m *RemoteStatsMonitor) GetInterval() time.Duration
- func (m *RemoteStatsMonitor) GetSampleDelta() time.Duration
- func (m *RemoteStatsMonitor) IsRunning() bool
- func (m *RemoteStatsMonitor) SetInterval(interval time.Duration)
- func (m *RemoteStatsMonitor) SetLogFile(filename string) error
- func (m *RemoteStatsMonitor) SetLogLineFunc(logLineFunc func(*SystemStats) ([]byte, error))
- func (m *RemoteStatsMonitor) SetSampleDelta(sampleDelta time.Duration)
- func (m *RemoteStatsMonitor) StartAsync() error
- func (m *RemoteStatsMonitor) StartSync() error
- func (m *RemoteStatsMonitor) Stop()
- type SystemStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRemoteStatsCollectorFromSFTP ¶
func NewRemoteStatsCollectorFromSFTP(sftpClient *sftp.Client, sampleDelta time.Duration) *remoteStatsCollector
NewRemoteStatsCollectorFromSFTP creates a new instance of remoteStatsCollector from an existing SFTP client
func NewRemoteStatsCollectorFromSSH ¶
func NewRemoteStatsCollectorFromSSH(sshClient *ssh.Client, sampleDelta time.Duration) (*remoteStatsCollector, error)
NewRemoteStatsCollectorFromSSH creates a new instance of remoteStatsCollector from an SSH connection
func NewRemoteStatsCollectorFromSSHConfig ¶
func NewRemoteStatsCollectorFromSSHConfig(serverAddress string, config *ssh.ClientConfig, sampleDelta time.Duration) (*remoteStatsCollector, error)
NewRemoteStatsCollectorFromSSHConfig creates a new instance of remoteStatsCollector from SSH configuration
func PrintSystemStats ¶
func PrintSystemStats(stats *SystemStats)
func SystemStatsToJSON ¶
func SystemStatsToJSON(stats *SystemStats) map[string]any
Types ¶
type RemoteStatsMonitor ¶
type RemoteStatsMonitor struct {
// contains filtered or unexported fields
}
RemoteStatsMonitor monitors remote system stats at regular intervals
func NewRemoteStatsMonitorFromSFTP ¶
func NewRemoteStatsMonitorFromSFTP(sftpClient *sftp.Client, interval time.Duration, sampleDelta time.Duration, logger *log.Logger) *RemoteStatsMonitor
NewRemoteStatsMonitorFromSFTP creates a new monitor from an existing SFTP client
func NewRemoteStatsMonitorFromSSH ¶
func NewRemoteStatsMonitorFromSSH(sshClient *ssh.Client, interval time.Duration, sampleDelta time.Duration, logger *log.Logger) (*RemoteStatsMonitor, error)
NewRemoteStatsMonitorFromSSH creates a new monitor from an existing SSH client
func NewRemoteStatsMonitorFromSSHConfig ¶
func NewRemoteStatsMonitorFromSSHConfig(serverAddress string, config *ssh.ClientConfig, interval time.Duration, sampleDelta time.Duration, logger *log.Logger) (*RemoteStatsMonitor, error)
NewRemoteStatsMonitorFromSSHConfig creates a new monitor from SSH configuration
func (*RemoteStatsMonitor) Close ¶
func (m *RemoteStatsMonitor) Close() error
Close closes the underlying collector and stops monitoring
func (*RemoteStatsMonitor) GetCurrentStats ¶
func (m *RemoteStatsMonitor) GetCurrentStats() (*SystemStats, error)
GetCurrentStats gets the current system stats without logging
func (*RemoteStatsMonitor) GetInterval ¶
func (m *RemoteStatsMonitor) GetInterval() time.Duration
GetInterval returns the current monitoring interval
func (*RemoteStatsMonitor) GetSampleDelta ¶
func (m *RemoteStatsMonitor) GetSampleDelta() time.Duration
GetSampleDelta returns the current CPU sampling interval
func (*RemoteStatsMonitor) IsRunning ¶
func (m *RemoteStatsMonitor) IsRunning() bool
IsRunning returns whether the monitor is currently running
func (*RemoteStatsMonitor) SetInterval ¶
func (m *RemoteStatsMonitor) SetInterval(interval time.Duration)
SetInterval updates the monitoring interval (only effective after restart)
func (*RemoteStatsMonitor) SetLogFile ¶
func (m *RemoteStatsMonitor) SetLogFile(filename string) error
SetLogFile sets the logger to write to the specified file
func (*RemoteStatsMonitor) SetLogLineFunc ¶
func (m *RemoteStatsMonitor) SetLogLineFunc(logLineFunc func(*SystemStats) ([]byte, error))
SetLogLine sets a custom log line formatting function
func (*RemoteStatsMonitor) SetSampleDelta ¶
func (m *RemoteStatsMonitor) SetSampleDelta(sampleDelta time.Duration)
SetSampleDelta updates the CPU sampling interval (only effective after restart)
func (*RemoteStatsMonitor) StartAsync ¶
func (m *RemoteStatsMonitor) StartAsync() error
StartAsync starts monitoring asynchronously (non-blocking call)
func (*RemoteStatsMonitor) StartSync ¶
func (m *RemoteStatsMonitor) StartSync() error
StartSync starts monitoring synchronously (blocking call)
func (*RemoteStatsMonitor) Stop ¶
func (m *RemoteStatsMonitor) Stop()
Stop stops the monitoring by cancelling the internal context