system

package
v0.0.0-...-8680cc4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDevID

func GetDevID(dir string) (uint64, error)

GetDevID returns device id via syscall according to the input directory.

func GetNodeIP

func GetNodeIP() string

GetNodeIP fetches node ip via command hostname. If it fails to get this, return empty string directly.

func GetOSName

func GetOSName() (string, error)

GetOSName gets data in /etc/os-release and gets OS name. For example, in a Ubuntu host, fetched data are like: root@i-8brpbc9t:~# cat /etc/os-release NAME="Ubuntu" VERSION="16.04.2 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.2 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial

func GetSerialNumber

func GetSerialNumber() string

GetSerialNumber gets serial number or a machine.

func GetTotalMem

func GetTotalMem() (uint64, error)

GetTotalMem gets total ram of host.

Types

type BlkioCgroupInfo

type BlkioCgroupInfo struct {
	BlkioWeight          bool
	BlkioWeightDevice    bool
	BlkioDeviceReadBps   bool
	BlkioDeviceWriteBps  bool
	BlkioDeviceReadIOps  bool
	BlkioDeviceWriteIOps bool
}

BlkioCgroupInfo defines blkio cgroup information on current machine

type CPUCgroupInfo

type CPUCgroupInfo struct {
	CpusetCpus bool
	CpusetMems bool
	CPUShares  bool
	CPUPeriod  bool
	CPUQuota   bool
}

CPUCgroupInfo defines cpu cgroup information on current machine

type CgroupInfo

type CgroupInfo struct {
	Memory *MemoryCgroupInfo
	CPU    *CPUCgroupInfo
	Blkio  *BlkioCgroupInfo
	Pids   *PidsCgroupInfo
}

CgroupInfo defines cgroup information on current machine

func NewCgroupInfo

func NewCgroupInfo() *CgroupInfo

NewCgroupInfo news a CgroupInfo struct

type Info

type Info struct {
	AppArmor bool
	Seccomp  bool

	*CgroupInfo
}

Info defines system info on current machine

func NewInfo

func NewInfo() *Info

NewInfo creates a system info about current machine.

type MemoryCgroupInfo

type MemoryCgroupInfo struct {
	MemoryLimit       bool
	MemoryReservation bool
	MemorySwap        bool
	MemorySwappiness  bool
	OOMKillDisable    bool
}

MemoryCgroupInfo defines memory cgroup information on current machine

type PidsCgroupInfo

type PidsCgroupInfo struct {
	Pids bool
}

PidsCgroupInfo defines pid cgroup information on current machine

Jump to

Keyboard shortcuts

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