status

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatusStream

func GetStatusStream(ctx context.Context, client *sshhelper.Client, interval time.Duration) (chan *Status, error)

func ParseMacCPUUsage

func ParseMacCPUUsage(output string) (user, system, idle float64, err error)

CPU usage: 6.97% user, 13.22% sys, 79.80% idle

Types

type CPUStat

type CPUStat struct {
	CPU       string
	User      uint64
	Nice      uint64
	System    uint64
	Idle      uint64
	Iowait    uint64
	Irq       uint64
	Softirq   uint64
	Steal     uint64
	Guest     uint64
	GuestNice uint64
}

func GetCPUStats

func GetCPUStats(output string) ([]CPUStat, error)

GetCPUStats reads /proc/stat and returns CPU statistics expected input: cpu 1001370 17361 706987 1369338765 328267 0 128294 21095 0 0 cpu0 503074 8389 381024 684596825 174006 0 63274 10996 0 0 cpu1 498296 8972 325962 684741940 154261 0 65019 10098 0 0

type DiskInfo

type DiskInfo struct {
	Filesystem    string
	SizeTotal     int64 // in bytes
	SizeUsed      int64 // in bytes
	SizeAvailable int64 // in bytes
	UsagePercent  float64
	MountedOn     string
}

DiskInfo represents information about a disk partition

func ParseDfOutput

func ParseDfOutput(output string) ([]DiskInfo, error)

Filesystem 1K-blocks Used Available Use% Mounted on udev 484896 0 484896 0% /dev tmpfs 99328 472 98856 1% /run /dev/sda1 10089736 3077584 6478036 33% / tmpfs 496632 0 496632 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock /dev/sda15 126678 11840 114838 10% /boot/efi tmpfs 99324 0 99324 0% /run/user/1000

type MemInfo

type MemInfo struct {
	// Memory
	MemTotal     uint64
	MemFree      uint64
	MemAvailable uint64
	// Swap
	SwapTotal uint64
	SwapFree  uint64
}

MemInfo represents system memory information

func GetMemInfo

func GetMemInfo(output string) (*MemInfo, error)

type NetDevReceive

type NetDevReceive struct {
	Bytes      uint64
	Packets    uint64
	Errors     uint64
	Drop       uint64
	FIFO       uint64
	Frame      uint64
	Compressed uint64
	Multicast  uint64
}

NetDevReceive holds receive statistics

type NetDevStats

type NetDevStats struct {
	Interface string
	Receive   NetDevReceive
	Transmit  NetDevTransmit
}

NetDevStats represents statistics for a network interface

func ParseNetDev

func ParseNetDev(output string) ([]NetDevStats, error)

type NetDevTransmit

type NetDevTransmit struct {
	Bytes      uint64
	Packets    uint64
	Errors     uint64
	Drop       uint64
	FIFO       uint64
	Collisions uint64
	Carrier    uint64
	Compressed uint64
}

NetDevTransmit holds transmit statistics

type NetStatInfo

type NetStatInfo struct {
	Name      string // Interface name
	MTU       int    // Maximum transmission unit
	Network   string // Network address/prefix
	Address   string // Interface address
	RxBytes   int64  // Bytes received
	RxPackets int64  // Packets received
	RxErrors  int64  // Receive errors
	TxBytes   int64  // Bytes transmitted
	TxPackets int64  // Packets transmitted
	TxErrors  int64  // Transmit errors
}

func ParseNetstatIbn

func ParseNetstatIbn(output string) ([]NetStatInfo, error)

type PhysMemInfo

type PhysMemInfo struct {
	UsedTotal    int64 // Total used memory in MB
	WiredMB      int64 // Wired memory in MB
	CompressorMB int64 // Compressor memory in MB
	UnusedMB     int64 // Unused memory in MB
}

func ParsePhysMemInfoMac

func ParsePhysMemInfoMac(output string) (*PhysMemInfo, error)

type Status

type Status struct {
	CpuUsage    uint32 // percentage
	DiskUsed    uint32 // bytes
	DiskAll     uint32 // bytes
	MemAvail    uint64 // bytes
	MemAll      uint64 // bytes
	NetInUsage  uint64 // bytes
	NetOutUsage uint64 // bytes
	NetInSpeed  uint32 // bytes/s
	NetOutSpeed uint32 // bytes/s
}

Jump to

Keyboard shortcuts

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