system

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CancelRealTimeStatusCollection 取消实时状态搜集
	CancelRealTimeStatusCollection = func() {}
)

Functions

func IsNotImplemented added in v1.3.2

func IsNotImplemented(err error) bool

func ListenRealTimeStatus

func ListenRealTimeStatus(cfg *Settings)

ListenRealTimeStatus 监听实时状态

func RealTimeStatusIsListening

func RealTimeStatusIsListening() bool

RealTimeStatusIsListening 是否正在监听实时状态

func SensorsTemperatures

func SensorsTemperatures() ([]host.TemperatureStat, error)

Types

type AlarmThreshold

type AlarmThreshold struct {
	Memory float64
	CPU    float64
	Temp   float64
}

type DynamicInformation

type DynamicInformation struct {
	CPUPercent []float64
	Load       *load.AvgStat          `json:",omitempty"`
	Memory     *MemoryInformation     `json:",omitempty"`
	NetIO      []net.IOCountersStat   `json:",omitempty"`
	Temp       []host.TemperatureStat `json:",omitempty"`
}

func (*DynamicInformation) Init

func (*DynamicInformation) MemoryAndCPU

func (d *DynamicInformation) MemoryAndCPU() *DynamicInformation

func (*DynamicInformation) NetMemoryCPU

func (d *DynamicInformation) NetMemoryCPU() *DynamicInformation

func (*DynamicInformation) TemperatureStat

func (d *DynamicInformation) TemperatureStat() *DynamicInformation

type LastTimeValue

type LastTimeValue struct {
	Time  time.Time
	Value float64
}

LastTimeValue 上次时间的状态值

type MemoryInformation

type MemoryInformation struct {
	Virtual *mem.VirtualMemoryStat `json:",omitempty"`
	Swap    *mem.SwapMemoryStat    `json:",omitempty"`
}

type NetIOTimeSeries

type NetIOTimeSeries struct {
	BytesSent   TimeSeries
	BytesRecv   TimeSeries
	PacketsSent TimeSeries
	PacketsRecv TimeSeries
	// contains filtered or unexported fields
}

NetIOTimeSeries 网络IO时序数据结构

func NewNetIOTimeSeries

func NewNetIOTimeSeries() NetIOTimeSeries

NewNetIOTimeSeries 创建网络IO时序数据结构

type Process

type Process struct {
	Name       string  `json:"name"`
	Pid        int32   `json:"pid"`
	Ppid       int32   `json:"ppid"`
	CPUPercent float64 `json:"cpuPercent"`
	MemPercent float32 `json:"memPercent"`
	MemUsed    uint64  `json:"memUsed"`
	//Running    bool    `json:"running"`
	CreateTime string `json:"createTime"`

	Exe        string   `json:"exe"`
	Cmdline    string   `json:"cmdline"`
	Cwd        string   `json:"cwd"`
	Status     []string `json:"status"`
	Username   string   `json:"username"`
	NumThreads int32    `json:"numThreads"`
	NumFDs     int32    `json:"numFDs"`
	// contains filtered or unexported fields
}

func ProcessList

func ProcessList(ctx context.Context) ([]*Process, error)

func (*Process) MemoryPercentWithContext

func (p *Process) MemoryPercentWithContext(ctx context.Context, proc *process.Process) (float32, error)

func (*Process) Parse

func (p *Process) Parse(ctx context.Context, proc *process.Process) (*Process, error)

type ProcessListSortByCPUPercent

type ProcessListSortByCPUPercent []*Process

func (ProcessListSortByCPUPercent) Len

func (ProcessListSortByCPUPercent) Less

func (s ProcessListSortByCPUPercent) Less(i, j int) bool

func (ProcessListSortByCPUPercent) Swap

func (s ProcessListSortByCPUPercent) Swap(i, j int)

type ProcessListSortByCPUPercentReverse

type ProcessListSortByCPUPercentReverse []*Process

func (ProcessListSortByCPUPercentReverse) Len

func (ProcessListSortByCPUPercentReverse) Less

func (ProcessListSortByCPUPercentReverse) Swap

type ProcessListSortByCreated

type ProcessListSortByCreated []*Process

func (ProcessListSortByCreated) Len

func (s ProcessListSortByCreated) Len() int

func (ProcessListSortByCreated) Less

func (s ProcessListSortByCreated) Less(i, j int) bool

func (ProcessListSortByCreated) Swap

func (s ProcessListSortByCreated) Swap(i, j int)

type ProcessListSortByCreatedReverse

type ProcessListSortByCreatedReverse []*Process

func (ProcessListSortByCreatedReverse) Len

func (ProcessListSortByCreatedReverse) Less

func (ProcessListSortByCreatedReverse) Swap

func (s ProcessListSortByCreatedReverse) Swap(i, j int)

type ProcessListSortByMemPercent

type ProcessListSortByMemPercent []*Process

func (ProcessListSortByMemPercent) Len

func (ProcessListSortByMemPercent) Less

func (s ProcessListSortByMemPercent) Less(i, j int) bool

func (ProcessListSortByMemPercent) Swap

func (s ProcessListSortByMemPercent) Swap(i, j int)

type ProcessListSortByMemPercentReverse

type ProcessListSortByMemPercentReverse []*Process

func (ProcessListSortByMemPercentReverse) Len

func (ProcessListSortByMemPercentReverse) Less

func (ProcessListSortByMemPercentReverse) Swap

type ProcessListSortByNumFDs

type ProcessListSortByNumFDs []*Process

func (ProcessListSortByNumFDs) Len

func (s ProcessListSortByNumFDs) Len() int

func (ProcessListSortByNumFDs) Less

func (s ProcessListSortByNumFDs) Less(i, j int) bool

func (ProcessListSortByNumFDs) Swap

func (s ProcessListSortByNumFDs) Swap(i, j int)

type ProcessListSortByNumFDsReverse

type ProcessListSortByNumFDsReverse []*Process

func (ProcessListSortByNumFDsReverse) Len

func (ProcessListSortByNumFDsReverse) Less

func (ProcessListSortByNumFDsReverse) Swap

func (s ProcessListSortByNumFDsReverse) Swap(i, j int)

type ProcessListSortByNumThreads

type ProcessListSortByNumThreads []*Process

func (ProcessListSortByNumThreads) Len

func (ProcessListSortByNumThreads) Less

func (s ProcessListSortByNumThreads) Less(i, j int) bool

func (ProcessListSortByNumThreads) Swap

func (s ProcessListSortByNumThreads) Swap(i, j int)

type ProcessListSortByNumThreadsReverse

type ProcessListSortByNumThreadsReverse []*Process

func (ProcessListSortByNumThreadsReverse) Len

func (ProcessListSortByNumThreadsReverse) Less

func (ProcessListSortByNumThreadsReverse) Swap

type ProcessListSortByPid

type ProcessListSortByPid []*Process

func (ProcessListSortByPid) Len

func (s ProcessListSortByPid) Len() int

func (ProcessListSortByPid) Less

func (s ProcessListSortByPid) Less(i, j int) bool

func (ProcessListSortByPid) Swap

func (s ProcessListSortByPid) Swap(i, j int)

type ProcessListSortByPidReverse

type ProcessListSortByPidReverse []*Process

func (ProcessListSortByPidReverse) Len

func (ProcessListSortByPidReverse) Less

func (s ProcessListSortByPidReverse) Less(i, j int) bool

func (ProcessListSortByPidReverse) Swap

func (s ProcessListSortByPidReverse) Swap(i, j int)

type RealTimeStatus

type RealTimeStatus struct {
	CPU  TimeSeries
	Mem  TimeSeries
	Net  NetIOTimeSeries
	Temp map[string]TimeSeries
	// contains filtered or unexported fields
}

RealTimeStatus 实时状态数据结构

func NewRealTimeStatus

func NewRealTimeStatus(cfg *Settings, interval time.Duration, maxSize int) *RealTimeStatus

NewRealTimeStatus 创建实时状态数据结构

func RealTimeStatusObject

func RealTimeStatusObject(n ...int) *RealTimeStatus

RealTimeStatusObject 实时状态

func (*RealTimeStatus) CPUAdd

func (r *RealTimeStatus) CPUAdd(y float64) *RealTimeStatus

func (*RealTimeStatus) Listen

func (r *RealTimeStatus) Listen(ctx context.Context) *RealTimeStatus

Listen 监听

func (*RealTimeStatus) MemAdd

func (r *RealTimeStatus) MemAdd(y float64) *RealTimeStatus

func (*RealTimeStatus) NetAdd

func (*RealTimeStatus) SetSettings

func (r *RealTimeStatus) SetSettings(c *Settings, interval time.Duration, max int) *RealTimeStatus

func (*RealTimeStatus) TempAdd

type RuntimeStatus

type RuntimeStatus struct {
	NumGoroutine int
	// General statistics.
	MemAllocated uint64 // bytes allocated and still in use
	MemTotal     uint64 // bytes allocated (even if freed)
	MemSys       uint64 // bytes obtained from system (sum of XxxSys below)
	Lookups      uint64 // number of pointer lookups
	MemMallocs   uint64 // number of mallocs
	MemFrees     uint64 // number of frees
	// Main allocation heap statistics.
	HeapAlloc    uint64 // bytes allocated and still in use
	HeapSys      uint64 // bytes obtained from system
	HeapIdle     uint64 // bytes in idle spans
	HeapInuse    uint64 // bytes in non-idle span
	HeapReleased uint64 // bytes released to the OS
	HeapObjects  uint64 // total number of allocated objects
	// Low-level fixed-size structure allocator statistics.
	// Inuse is bytes used now.
	// Sys is bytes obtained from system.
	StackInuse  uint64 // bootstrap stacks
	StackSys    uint64
	MSpanInuse  uint64 // mspan structures
	MSpanSys    uint64
	MCacheInuse uint64 // mcache structures
	MCacheSys   uint64
	BuckHashSys uint64 // profiling bucket hash table
	GCSys       uint64 // GC metadata
	OtherSys    uint64 // other system allocations
	// Garbage collector statistics.
	NextGC       uint64 // next run in HeapAlloc time (bytes)
	LastGC       uint64 // last run in absolute time (ns)
	PauseTotalNs uint64
	PauseNs      string // circular buffer of recent GC pause times, most recent at [(NumGC+255)%256]
	NumGC        uint32
}

RuntimeStatus 运行时信息

func Status

func Status() *RuntimeStatus

Status go运行时信息

func (*RuntimeStatus) LastGCString

func (r *RuntimeStatus) LastGCString() string

LastGCString LastGC

func (*RuntimeStatus) PauseTotalNsString

func (r *RuntimeStatus) PauseTotalNsString() string

PauseTotalNsString PauseTotalNs

type Settings

type Settings struct {
	MonitorOn      bool           // 是否开启监控
	AlarmOn        bool           // 是否开启告警
	AlarmThreshold AlarmThreshold // 告警阀值
	ReportEmail    string         // 如有多个邮箱,则一行一个
}

func NewSettings

func NewSettings() *Settings

func (*Settings) FromStore

func (s *Settings) FromStore(h echo.H) *Settings

type SystemInformation

type SystemInformation struct {
	CPU        []cpu.InfoStat                 `json:",omitempty"`
	CPUPercent []float64                      `json:",omitempty"`
	Partitions []disk.PartitionStat           `json:",omitempty"`
	DiskUsages []*disk.UsageStat              `json:",omitempty"`
	DiskIO     map[string]disk.IOCountersStat `json:",omitempty"`
	Host       *host.InfoStat                 `json:",omitempty"`
	Load       *load.AvgStat                  `json:",omitempty"`
	Memory     *MemoryInformation             `json:",omitempty"`
	NetIO      []net.IOCountersStat           `json:",omitempty"`
	Temp       []host.TemperatureStat         `json:",omitempty"`
	Go         *RuntimeStatus                 `json:",omitempty"`
}

type TimeSeries

type TimeSeries []XY

type XY

type XY [2]interface{}

func NewXY

func NewXY(y float64) XY

Jump to

Keyboard shortcuts

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