system

package
v3.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

Functions

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 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