psutil

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudInstanceID

func CloudInstanceID() string

CloudInstanceID 云实例 ID

func InterfaceAddrs

func InterfaceAddrs(name string) ([]string, []string)

InterfaceAddrs 获取网卡 IP 地址列表

func PublicAddress

func PublicAddress(force bool) (string, string)

PublicAddress 获取公网 IP 地址

Types

type DetailStat

type DetailStat struct {
	*SummaryStat
	CpuModel       []string        `note:"CPU 型号" json:"cpuModel"`
	NetInterface   []NetInterface  `note:"网卡信息" json:"netInterface"`
	NetBytesRecv   uint64          `note:"网卡接收字节数" json:"netBytesRecv"`
	NetBytesSent   uint64          `note:"网卡发送字节数" json:"netBytesSent"`
	DiskPartition  []DiskPartition `note:"硬盘分区信息" json:"diskPartition"`
	DiskTotal      uint64          `note:"硬盘总量" json:"diskTotal"`
	DiskUsed       uint64          `note:"硬盘使用量" json:"diskUsed"`
	DiskReadBytes  uint64          `note:"硬盘读取字节数" json:"diskReadBytes"`
	DiskWriteBytes uint64          `note:"硬盘写入字节数" json:"diskWriteBytes"`
	SwapTotal      uint64          `note:"交换分区总量" json:"swapTotal"`
	SwapUsed       uint64          `note:"交换分区使用量" json:"swapUsed"`
}

func Detail

func Detail(withAddr bool) *DetailStat

type DiskPartition

type DiskPartition struct {
	Device     string `note:"设备名" json:"device"`
	Mountpoint string `note:"挂载点" json:"mountpoint"`
	Fstype     string `note:"文件系统" json:"fstype"`
	Total      uint64 `note:"总量" json:"total"`
	Used       uint64 `note:"使用量" json:"used"`
}

type GoMemoryStat

type GoMemoryStat struct {
	Alloc      uint64 `note:"已分配内存" json:"alloc"`
	Sys        uint64 `note:"已申请内存" json:"sys"`
	HeapAlloc  uint64 `note:"堆已分配内存" json:"heapAlloc"`
	HeapInuse  uint64 `note:"堆已使用内存" json:"heapInuse"`
	HeapSys    uint64 `note:"堆已申请内存" json:"heapSys"`
	StackInuse uint64 `note:"栈已使用内存" json:"stackInuse"`
	StackSys   uint64 `note:"栈已申请内存" json:"stackSys"`
	TotalAlloc uint64 `note:"累计已分配内存" json:"totalAlloc"`
	LastGC     uint64 `note:"最后一次 GC 时间" json:"lastGC"`
	NumGC      uint32 `note:"GC 执行次数" json:"numGC"`
}

func GoMemory

func GoMemory() *GoMemoryStat

GoMemory 获取 Go 内存统计信息

type NetInterface

type NetInterface struct {
	Name      string   `note:"网卡名称" json:"name"`
	BytesRecv uint64   `note:"接收字节数" json:"bytesRecv"`
	BytesSent uint64   `note:"发送字节数" json:"bytesSent"`
	Dropin    uint64   `note:"丢弃的接收包" json:"dropin"`
	Dropout   uint64   `note:"丢弃的发送包" json:"dropout"`
	Ipv4List  []string `note:"IPV4 列表" json:"ipv4List"`
	Ipv6List  []string `note:"IPV6 列表" json:"ipv6List"`
}

type SummaryStat

type SummaryStat struct {
	CreateAt     int64     `note:"创建时间" json:"createAt"`
	HostId       string    `note:"主机 ID" json:"hostId"`
	HostName     string    `note:"主机名" json:"hostName"`
	Uptime       uint64    `note:"运行时间" json:"uptime"`
	OS           string    `note:"操作系统" json:"os"`
	Platform     string    `note:"平台" json:"platform"`
	KernelArch   string    `note:"内核架构" json:"kernelArch"`
	CPUCore      int       `note:"CPU 核心数" json:"cpuCore"`
	CPUCoreLogic int       `note:"CPU 逻辑核心数" json:"cpuCoreLogic"`
	CpuPercent   []float64 `note:"CPU 使用率" json:"cpuPercent"`
	MemoryTotal  uint64    `note:"内存总量" json:"memoryTotal"`
	MemoryUsed   uint64    `note:"内存使用量" json:"memoryUsed"`
	PublicIPv4   string    `note:"公网 IPV4" json:"publicIpv4"`
	PublicIPv6   string    `note:"公网 IPV6" json:"publicIpv6"`
}

func Summary

func Summary(withAddr bool) *SummaryStat

func (*SummaryStat) From

func (p *SummaryStat) From(s string)

func (*SummaryStat) String

func (p *SummaryStat) String() string

Jump to

Keyboard shortcuts

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