osinfo

package
v0.0.0-...-c2f970a Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KB = uint64(1024)

Variables

This section is empty.

Functions

func GetDiskUsage

func GetDiskUsage() map[string]float64

return disk usage as GiB

TODO different functions for all disks / a specified disk? FIXME Wrong Disk values for docker !!! (probably because counting also virtual mountpoints?)

func GetDisks

func GetDisks() []disk.PartitionStat

return all physical disks, USB and CD-ROM devices

An example output: device: /dev/example, mountpoint: /, fstype: ext4, opts:rw,noatime

Types

type CPU

type CPU struct {
	Vendor  string `json:"vendor,omitempty"`
	Model   string `json:"model,omitempty"`
	Speed   uint   `json:"speed,omitempty"`   // CPU clock rate in MHz
	Cache   uint   `json:"cache,omitempty"`   // CPU cache size in KB
	Cpus    uint   `json:"cpus,omitempty"`    // number of physical CPUs
	Cores   uint   `json:"cores,omitempty"`   // number of physical CPU cores
	Threads uint   `json:"threads,omitempty"` // number of logical (HT) CPU cores
}

type Disk

type Disk struct {
	Devices string  `json:"devices,omitempty"` // physical disk devices as string
	Total   float64 `json:"total,omitempty"`   // Total Disk size in GiB
	Used    float64 `json:"used,omitempty"`    // Used Disk size in GiB
	Free    float64 `json:"free,omitempty"`    // Free Disk size in GiB
}

type Kernel

type Kernel struct {
	Sysname string `json:"sysname,omitempty"`
	Release string `json:"release,omitempty"`
	Version string `json:"version,omitempty"`
	Arch    string `json:"arch,omitempty"`
}

type Memory

type Memory struct {
	Type  string  `json:"type,omitempty"`
	Speed uint    `json:"speed,omitempty"` // RAM data rate in MT/s
	Total float64 `json:"total,omitempty"` // Total RAM size in GiB
	Used  float64 `json:"used,omitempty"`  // Used RAM size in GiB
}

type Node

type Node struct {
	Domainname string `json:"domainname,omitempty"`
	Hostname   string `json:"hostname,omitempty"`
	MachineID  string `json:"machineid,omitempty"`
	Hypervisor string `json:"hypervisor,omitempty"`
	Timezone   string `json:"timezone,omitempty"`
}

type OS

type OS struct {
	Name    string `json:"name,omitempty"`
	Distro  string `json:"distro,omitempty"`
	Version string `json:"version,omitempty"`
	Release string `json:"release,omitempty"`
	Arch    string `json:"architecture,omitempty"`
}

type System

type System struct {
	Kernel Kernel `json:"kernel"`
	OS     OS     `json:"OS"`
	Node   Node   `json:"node"`

	CPU    CPU    `json:"cpu"`
	Memory Memory `json:"memory"`
	Disk   Disk   `json:"disk"`
}

func (*System) GetSystemInfo

func (h *System) GetSystemInfo()

initializes all hardware structs that gets software and hardware (system) information

Jump to

Keyboard shortcuts

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