package types
import "github.com/elastic/go-sysinfo/types"
Index ¶
- Variables
- type CPUTimer
- type CPUTimes
- type Capabilities
- type CapabilityInfo
- type Environment
- type GoInfo
- type Host
- type HostInfo
- type HostMemoryInfo
- type LoadAverage
- type LoadAverageInfo
- type MemoryInfo
- type OSInfo
- type OpenHandleCounter
- type OpenHandleEnumerator
- type Process
- type ProcessInfo
- type Seccomp
- type SeccompInfo
- type UserInfo
Variables ¶
Types ¶
type CPUTimer ¶
type CPUTimer interface { // CPUTime returns a CPUTimes structure for // the host or some process. // // The User and System fields are guaranteed // to be populated for all platforms, and // for both hosts and processes. CPUTime() (CPUTimes, error) }
type CPUTimes ¶
type CPUTimes struct { User time.Duration `json:"user"` System time.Duration `json:"system"` Idle time.Duration `json:"idle,omitempty"` IOWait time.Duration `json:"iowait,omitempty"` IRQ time.Duration `json:"irq,omitempty"` Nice time.Duration `json:"nice,omitempty"` SoftIRQ time.Duration `json:"soft_irq,omitempty"` Steal time.Duration `json:"steal,omitempty"` }
func (CPUTimes) Total ¶
type Capabilities ¶
type Capabilities interface { Capabilities() (*CapabilityInfo, error) }
type CapabilityInfo ¶
type CapabilityInfo struct { Inheritable []string `json:"inheritable"` Permitted []string `json:"permitted"` Effective []string `json:"effective"` Bounding []string `json:"bounding"` Ambient []string `json:"ambient"` }
type Environment ¶
type GoInfo ¶
type GoInfo struct { OS string `json:"os"` Arch string `json:"arch"` MaxProcs int `json:"max_procs"` Version string `json:"version"` }
type Host ¶
type Host interface { CPUTimer Info() HostInfo Memory() (*HostMemoryInfo, error) }
type HostInfo ¶
type HostInfo struct { Architecture string `json:"architecture"` // Hardware architecture (e.g. x86_64, arm, ppc, mips). BootTime time.Time `json:"boot_time"` // Host boot time. Containerized *bool `json:"containerized,omitempty"` // Is the process containerized. Hostname string `json:"name"` // Hostname IPs []string `json:"ip,omitempty"` // List of all IPs. KernelVersion string `json:"kernel_version"` // Kernel version. MACs []string `json:"mac"` // List of MAC addresses. OS *OSInfo `json:"os"` // OS information. Timezone string `json:"timezone"` // System timezone. TimezoneOffsetSec int `json:"timezone_offset_sec"` // Timezone offset (seconds from UTC). UniqueID string `json:"id,omitempty"` // Unique ID of the host (optional). }
func (HostInfo) Uptime ¶
type HostMemoryInfo ¶
type HostMemoryInfo struct { Total uint64 `json:"total_bytes"` // Total physical memory. Used uint64 `json:"used_bytes"` // Total - Free Available uint64 `json:"available_bytes"` // Amount of memory available without swapping. Free uint64 `json:"free_bytes"` // Amount of memory not used by the system. VirtualTotal uint64 `json:"virtual_total_bytes"` // Total virtual memory. VirtualUsed uint64 `json:"virtual_used_bytes"` // VirtualTotal - VirtualFree VirtualFree uint64 `json:"virtual_free_bytes"` // Virtual memory that is not used. Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. }
HostMemoryInfo (all values are specified in bytes).
type LoadAverage ¶
type LoadAverage interface { LoadAverage() LoadAverageInfo }
type LoadAverageInfo ¶
type LoadAverageInfo struct { One float64 `json:"one_min"` Five float64 `json:"five_min"` Fifteen float64 `json:"fifteen_min"` }
type MemoryInfo ¶
type MemoryInfo struct { Resident uint64 `json:"resident_bytes"` Virtual uint64 `json:"virtual_bytes"` Metrics map[string]uint64 `json:"raw,omitempty"` // Other memory related metrics. }
type OSInfo ¶
type OSInfo struct { Family string `json:"family"` // OS Family (e.g. redhat, debian, freebsd, windows). Platform string `json:"platform"` // OS platform (e.g. centos, ubuntu, windows). Name string `json:"name"` // OS Name (e.g. Mac OS X, CentOS). Version string `json:"version"` // OS version (e.g. 10.12.6). Major int `json:"major"` // Major release version. Minor int `json:"minor"` // Minor release version. Patch int `json:"patch"` // Patch release version. Build string `json:"build,omitempty"` // Build (e.g. 16G1114). Codename string `json:"codename,omitempty"` // OS codename (e.g. jessie). }
type OpenHandleCounter ¶
OpenHandleCount returns the number the open file handles.
type OpenHandleEnumerator ¶
OpenHandleEnumerator lists the open file handles.
type Process ¶
type Process interface { CPUTimer Info() (ProcessInfo, error) Memory() (MemoryInfo, error) User() (UserInfo, error) Parent() (Process, error) PID() int }
type ProcessInfo ¶
type ProcessInfo struct { Name string `json:"name"` PID int `json:"pid"` PPID int `json:"ppid"` CWD string `json:"cwd"` Exe string `json:"exe"` Args []string `json:"args"` StartTime time.Time `json:"start_time"` }
type Seccomp ¶
type Seccomp interface { Seccomp() (*SeccompInfo, error) }
type SeccompInfo ¶
type SeccompInfo struct { Mode string `json:"mode"` NoNewPrivs *bool `json:"no_new_privs,omitempty"` // Added in kernel 4.10. }
type UserInfo ¶
type UserInfo struct { // UID is the user ID. // On Linux and Darwin (macOS) this is the real user ID. // On Windows, this is the security identifier (SID) of the // user account of the process access token. UID string `json:"uid"` // On Linux and Darwin (macOS) this is the effective user ID. // On Windows, this is empty. EUID string `json:"euid"` // On Linux and Darwin (macOS) this is the saved user ID. // On Windows, this is empty. SUID string `json:"suid"` // GID is the primary group ID. // On Linux and Darwin (macOS) this is the real group ID. // On Windows, this is the security identifier (SID) of the // primary group of the process access token. GID string `json:"gid"` // On Linux and Darwin (macOS) this is the effective group ID. // On Windows, this is empty. EGID string `json:"egid"` // On Linux and Darwin (macOS) this is the saved group ID. // On Windows, this is empty. SGID string `json:"sgid"` }
UserInfo contains information about the UID and GID values of a process.
Source Files ¶
errors.go go.go host.go process.go
- Version
- v1.0.2
- Published
- Jul 9, 2019
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 3 hours ago –
Tools for package owners.