system

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// B to byte
	B = 1
	// KB to B
	KB = 1024 * B
	// MB to KB
	MB = 1024 * KB
	// GB to MB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUHealth

type CPUHealth struct {
	Health

	CPUCores      int     `json:"cpuCores"`
	LoadAverage1  float64 `json:"loadAverage1"`
	LoadAverage5  float64 `json:"loadAverage5"`
	LoadAverage15 float64 `json:"loadAverage15"`
}

CPUHealth includes CPU cores, load average for one minutes, load average for five minutes, load average for fifteen minutes and health status

func CPUCheck

func CPUCheck() *CPUHealth

CPUCheck checks the cpu usage.

func (*CPUHealth) GetHealthStatusByCores

func (c *CPUHealth) GetHealthStatusByCores() string

GetHealthStatusByCores only fot CPU check; get health status by CPU cores

type DiskHealth

type DiskHealth struct {
	Health
	HealthPercent

	Used  string `json:"used"`
	Total string `json:"total"`
}

DiskHealth includes used disk, total disk, used percent and health status

func DiskCheck

func DiskCheck() *DiskHealth

DiskCheck checks the disk usage.

type Health

type Health struct {
	HealthStatus string `json:"healthStatus"`
}

Health basic struct include health status

type HealthPercent

type HealthPercent struct {
	UsedPercent int `json:"usedPercent"`
}

HealthPercent include health percentage

func (*HealthPercent) GetHealthStatusByPercent

func (h *HealthPercent) GetHealthStatusByPercent() string

GetHealthStatusByPercent get health status by percentage

type RAMHealth

type RAMHealth struct {
	Health
	HealthPercent

	Used  string `json:"used"`
	Total string `json:"total"`
}

RAMHealth includes used RAM, total RAM, used percent and health status

func RAMCheck

func RAMCheck() *RAMHealth

RAMCheck checks the RAM usage.

type SystemInfo

type SystemInfo struct {
	Hostname string `json:"hostname"`
	Uptime   string `json:"uptime"`
	OS       string `json:"os"`
	Platform string `json:"platform"`
}

SystemInfo system information

func SystemInfoCheck

func SystemInfoCheck() *SystemInfo

SystemInfoCheck get system information

Jump to

Keyboard shortcuts

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