info

package
v0.0.0-...-9498627 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUinfo

func CPUinfo() ([]cpu.InfoStat, error)

CPUinfo info on cpu

func Connections

func Connections() ([]net.ConnectionStat, error)

Connections return all active connection

func ContainersID

func ContainersID() ([]string, error)

ContainersID return slice of container id

func Sessions

func Sessions() ([]host.UserStat, error)

Sessions of active users on system

func Users

func Users() ([]*user.User, error)

Users list all system user

Types

type CPUStat

type CPUStat struct {
	Count cpuCount  `json:"count"`
	Info  []cpuInfo `json:"info"`
}

CPUStat desc

func (CPUStat) Format

func (cs CPUStat) Format() CPUStatFormat

Format CPUStat

func (CPUStat) Text

func (cs CPUStat) Text() CPUStatFormat

Text CPUStat

type CPUStatFormat

type CPUStatFormat struct {
	Count cpuCountFormat  `json:"count"`
	Info  []cpuInfoFormat `json:"info"`
}

CPUStatFormat desc

func CPU

func CPU(format bool) (CPUStatFormat, error)

CPU info

func (CPUStatFormat) String

func (cs CPUStatFormat) String() string

type ContainerStat

type ContainerStat struct {
	ContainerID string           `json:"containerId"`
	Name        string           `json:"name"`
	Image       string           `json:"image"`
	Status      string           `json:"status"`
	Running     bool             `json:"running"`
	CPU         containerCPUStat `json:"cpu"`
	Memory      containerMemStat `json:"memory"`
}

ContainerStat def

func (ContainerStat) Format

func (ds ContainerStat) Format() ContainerStatFormat

Format return

func (ContainerStat) Text

Text return

type ContainerStatFormat

type ContainerStatFormat struct {
	ContainerID string                 `json:"containerId"`
	Name        string                 `json:"name"`
	Image       string                 `json:"image"`
	Status      string                 `json:"status"`
	Running     string                 `json:"running"`
	CPU         containerCPUStatFormat `json:"cpu"`
	Memory      containerMemStatFormat `json:"memory"`
}

ContainerStatFormat def

func Containers

func Containers(format bool) ([]ContainerStatFormat, error)

Containers info

func (ContainerStatFormat) String

func (ds ContainerStatFormat) String() string

type DiskStat

type DiskStat struct {
	Device     string       `json:"device"`
	Mountpoint string       `json:"mountpoint"`
	Fstype     string       `json:"fstype"`
	Opts       string       `json:"opts"`
	Usage      diskUsage    `json:"usage"`
	IOCounters diskCounters `json:"iocounters"`
}

DiskStat def

func (DiskStat) Format

func (d DiskStat) Format() DiskStatFormat

Format of DiskStat

func (DiskStat) Text

func (d DiskStat) Text() DiskStatFormat

Text of DiskStat

type DiskStatFormat

type DiskStatFormat struct {
	Device     string             `json:"device"`
	Mountpoint string             `json:"mountpoint"`
	Fstype     string             `json:"fstype"`
	Opts       string             `json:"opts"`
	Usage      diskUsageFormat    `json:"usage"`
	IOCounters diskCountersFormat `json:"iocounters"`
}

DiskStatFormat def

func Disks

func Disks(format bool) ([]DiskStatFormat, error)

Disks info

func (DiskStatFormat) String

func (d DiskStatFormat) String() string

type GeneralStatFormat

type GeneralStatFormat struct {
	CPU        CPUStatFormat            `json:"cpu"`
	Disks      []DiskStatFormat         `json:"disks"`
	Containers []ContainerStatFormat    `json:"containers"`
	Host       HostStatFormat           `json:"host"`
	Memory     MemoryStatFormat         `json:"memory"`
	Network    NetworkStatFormat        `json:"network"`
	Processes  []ProcessLightStatFormat `json:"processes"`
}

GeneralStatFormat def

func General

func General(format bool) (GeneralStatFormat, error)

General system information

type HostStat

type HostStat struct {
	Hostname             string       `json:"hostname"`
	Uptime               second       `json:"uptime"`
	BootTime             systemtime   `json:"bootTime"`
	Procs                number       `json:"procs"`
	OS                   string       `json:"os"`
	Platform             string       `json:"platform"`
	PlatformFamily       string       `json:"platformFamily"`
	PlatformVersion      string       `json:"platformVersion"`
	KernelVersion        string       `json:"kernelVersion"`
	VirtualizationSystem string       `json:"virtualizationSystem"`
	VirtualizationRole   string       `json:"virtualizationRole"`
	HostID               string       `json:"hostid"`
	Sensors              []sensorStat `json:"sensors"`
}

HostStat def

func (HostStat) Format

func (hs HostStat) Format() HostStatFormat

Format formatting

func (HostStat) Text

func (hs HostStat) Text() HostStatFormat

Text formatting

type HostStatFormat

type HostStatFormat struct {
	Hostname             string             `json:"hostname"`
	Uptime               string             `json:"uptime"`
	BootTime             string             `json:"bootTime"`
	Procs                string             `json:"procs"`
	OS                   string             `json:"os"`
	Platform             string             `json:"platform"`
	PlatformFamily       string             `json:"platformFamily"`
	PlatformVersion      string             `json:"platformVersion"`
	KernelVersion        string             `json:"kernelVersion"`
	VirtualizationSystem string             `json:"virtualizationSystem"`
	VirtualizationRole   string             `json:"virtualizationRole"`
	HostID               string             `json:"hostId"`
	Sensors              []sensorStatFormat `json:"sensors"`
}

HostStatFormat def

func Host

func Host(format bool) (HostStatFormat, error)

Host information

func (HostStatFormat) String

func (hs HostStatFormat) String() string

type MemoryStat

type MemoryStat struct {
	Total       byte    `json:"total"`
	Available   byte    `json:"available"`
	Used        byte    `json:"used"`
	UsedPercent percent `json:"usedPercent"`
	Free        byte    `json:"free"`
}

MemoryStat desc

func (MemoryStat) Format

func (ms MemoryStat) Format() MemoryStatFormat

Format MemoryStat values

func (MemoryStat) Text

func (ms MemoryStat) Text() MemoryStatFormat

Text MemoryStat values

type MemoryStatFormat

type MemoryStatFormat struct {
	Total       string `json:"total"`
	Available   string `json:"available"`
	Used        string `json:"used"`
	Usedpercent string `json:"usedpercent"`
	Free        string `json:"free"`
}

MemoryStatFormat desc

func Memory

func Memory(format bool) (MemoryStatFormat, error)

Memory return memory info

func (MemoryStatFormat) String

func (ms MemoryStatFormat) String() string

type NetworkStat

type NetworkStat struct {
	Usage      networkIOCounter   `json:"usage"`
	Interfaces []networkInterface `json:"interfaces"`
}

NetworkStat def

func (NetworkStat) Format

func (ns NetworkStat) Format() NetworkStatFormat

Format network stat

func (NetworkStat) Text

func (ns NetworkStat) Text() NetworkStatFormat

Text formatting

type NetworkStatFormat

type NetworkStatFormat struct {
	Usage      networkIOCounterFormat   `json:"usage"`
	Interfaces []networkInterfaceFormat `json:"interfaces"`
}

NetworkStatFormat def

func Network

func Network(format bool) (NetworkStatFormat, error)

Network information

func (NetworkStatFormat) String

func (ns NetworkStatFormat) String() string

type ProcessLightStat

type ProcessLightStat struct {
	Pid        number         `json:"pid"`
	Name       string         `json:"name"`
	Username   string         `json:"username"`
	Status     string         `json:"status"`
	Uids       numberSlice    `json:"uids"`
	Gids       numberSlice    `json:"gids"`
	Terminal   string         `json:"terminal"`
	Cwd        string         `json:"cwd"`
	Exe        string         `json:"exe"`
	CmdArgs    []string       `json:"cmdArgs"`
	Ppid       number         `json:"ppid"`
	CPU        processCPUInfo `json:"cpu"`
	Memory     processMemInfo `json:"memory"`
	CreateTime systemtime     `json:"createTime"`
}

ProcessLightStat def

func (ProcessLightStat) Format

Format return

func (ProcessLightStat) Text

Text conversion

type ProcessLightStatFormat

type ProcessLightStatFormat struct {
	Pid        string               `json:"pid"`
	Name       string               `json:"name"`
	Username   string               `json:"username"`
	Status     string               `json:"status"`
	Uids       []string             `json:"uids"`
	Gids       []string             `json:"gids"`
	Terminal   string               `json:"terminal"`
	Cwd        string               `json:"cwd"`
	Exe        string               `json:"exe"`
	CmdArgs    []string             `json:"cmdArgs"`
	Ppid       string               `json:"ppid"`
	CPU        processCPUInfoFormat `json:"cpu"`
	Memory     processMemInfoFormat `json:"memory"`
	CreateTime string               `json:"createTime"`
}

ProcessLightStatFormat def

func Processes

func Processes(format bool) ([]ProcessLightStatFormat, error)

Processes return all processes informations

type ProcessStat

type ProcessStat struct {
	Pid         number                  `json:"pid"`
	Name        string                  `json:"name"`
	Username    string                  `json:"username"`
	Status      string                  `json:"status"`
	Uids        numberSlice             `json:"uids"`
	Gids        numberSlice             `json:"gids"`
	Terminal    string                  `json:"terminal"`
	Cwd         string                  `json:"cwd"`
	Exe         string                  `json:"exe"`
	CmdArgs     []string                `json:"cmdArgs"`
	Ppid        number                  `json:"ppid"`
	Parent      ProcessLightStat        `json:"parent"`
	Children    []ProcessLightStat      `json:"children"`
	CPU         processCPUInfo          `json:"cpu"`
	Memory      processMemInfo          `json:"memory"`
	Network     networkIOCounter        `json:"network"`
	Disk        processDiskInfo         `json:"disk"`
	Connections []net.ConnectionStat    `json:"connections"`
	NumFDS      number                  `json:"numFds"`
	OpenFiles   []process.OpenFilesStat `json:"openFiles"`
	NumThreads  number                  `json:"numThread"`
	Threads     map[number]cpuTimes     `json:"threads"`
	Rlimits     []processLimit          `json:"limits"`
	IsRunning   bool                    `json:"isRunning"`
	Background  bool                    `json:"background"`
	Foreground  bool                    `json:"foreground"`
	CreateTime  systemtime              `json:"createTime"`
}

ProcessStat def

func (ProcessStat) Format

func (p ProcessStat) Format() ProcessStatFormat

Format conversion

func (ProcessStat) Text

func (p ProcessStat) Text() ProcessStatFormat

Text conversion

type ProcessStatFormat

type ProcessStatFormat struct {
	Pid         string                    `json:"pid"`
	Name        string                    `json:"name"`
	Username    string                    `json:"username"`
	Status      string                    `json:"status"`
	Uids        []string                  `json:"uids"`
	Gids        []string                  `json:"gids"`
	Terminal    string                    `json:"terminal"`
	Cwd         string                    `json:"cwd"`
	Exe         string                    `json:"exe"`
	CmdArgs     []string                  `json:"cmdArgs"`
	Ppid        string                    `json:"ppid"`
	Parent      ProcessLightStatFormat    `json:"parent"`
	Children    []ProcessLightStatFormat  `json:"children"`
	CPU         processCPUInfoFormat      `json:"cpu"`
	Memory      processMemInfoFormat      `json:"memory"`
	Network     networkIOCounterFormat    `json:"network"`
	Disk        processDiskInfoFormat     `json:"disk"`
	Connections []net.ConnectionStat      `json:"connections"`
	NumFDS      string                    `json:"numFds"`
	OpenFiles   []process.OpenFilesStat   `json:"openFiles"`
	NumThreads  string                    `json:"numThread"`
	Threads     map[string]cpuTimesFormat `json:"threads"`
	Rlimits     []processLimitFormat      `json:"limits"`
	IsRunning   bool                      `json:"isRunning"`
	Background  bool                      `json:"background"`
	Foreground  bool                      `json:"foreground"`
	CreateTime  string                    `json:"createTime"`
}

ProcessStatFormat def

func Process

func Process(pid int32, format bool) (ProcessStatFormat, error)

Process return stat of one process

func (ProcessStatFormat) String

func (p ProcessStatFormat) String() string

Jump to

Keyboard shortcuts

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