Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostInfo ¶
type HostInfo struct { // Timestamp returns the timestamp in UTC on the collection time. Timestamp time.Time `json:"timestamp"` // CPU returns information about the CPU such as family, model, cores, etc. CPU []cpu.InfoStat `json:"cpu"` // CPUTimes returns statistics on CPU usage represented in Jiffies. CPUTimes []cpu.TimesStat `json:"cpu_times"` // Disk returns statitics on disk usage for all accessible partitions. Disk []*disk.UsageStat `json:"disk"` // Host returns general host information such as hostname, platform, uptime, // kernel version, etc. Host *HostInfoStat `json:"host"` // Memory contains statistics about the memory such as total, available, and // used memory in number of bytes. Memory *VirtualMemoryStat `json:"memory"` }
HostInfo holds all the information that gets captured on the host. The set of information captured depends on the host operating system. For more information, refer to: https://github.com/shirou/gopsutil#current-status
func CollectHostInfo ¶
CollectHostInfo returns information on the host, which includes general host status, CPU, memory, and disk utilization.
The function does a best-effort capture on the most information possible, continuing on capture errors encountered and appending them to a resulting multierror.Error that gets returned at the end.
type HostInfoError ¶
HostInfoError is a typed error for more convenient error checking.
func (*HostInfoError) Error ¶
func (e *HostInfoError) Error() string
func (*HostInfoError) WrappedErrors ¶
func (e *HostInfoError) WrappedErrors() []error
type HostInfoStat ¶ added in v1.10.10
type HostInfoStat struct { Hostname string `json:"hostname"` Uptime uint64 `json:"uptime"` BootTime uint64 `json:"bootTime"` Procs uint64 `json:"procs"` OS string `json:"os"` Platform string `json:"platform"` PlatformFamily string `json:"platformFamily"` PlatformVersion string `json:"platformVersion"` KernelVersion string `json:"kernelVersion"` KernelArch string `json:"kernelArch"` VirtualizationSystem string `json:"virtualizationSystem"` VirtualizationRole string `json:"virtualizationRole"` HostID string `json:"hostid"` }
HostInfoStat describes the host status.
This struct is copied to maintain backwards compatibility in the Vault host-info API. This is done because gopsutil changed JSON struct tags between its v2 and v3 releases. For details see https://github.com/shirou/gopsutil/tree/master/_tools/v3migration.
func CollectHostInfoStat ¶ added in v1.10.10
func CollectHostInfoStat(ctx context.Context) (*HostInfoStat, error)
type VirtualMemoryStat ¶ added in v1.8.0
type VirtualMemoryStat struct { // Total amount of RAM on this system Total uint64 `json:"total"` // RAM available for programs to allocate // // This value is computed from the kernel specific values. Available uint64 `json:"available"` // RAM used by programs // // This value is computed from the kernel specific values. Used uint64 `json:"used"` // Percentage of RAM used by programs // // This value is computed from the kernel specific values. UsedPercent float64 `json:"usedPercent"` // This is the kernel's notion of free memory; RAM chips whose bits nobody // cares about the value of right now. For a human consumable number, // Available is what you really want. Free uint64 `json:"free"` // OS X / BSD specific numbers: // http://www.macyourself.com/2010/02/17/what-is-free-wired-active-and-inactive-system-memory-ram/ Active uint64 `json:"active"` Inactive uint64 `json:"inactive"` Wired uint64 `json:"wired"` // FreeBSD specific numbers: // https://reviews.freebsd.org/D8467 Laundry uint64 `json:"laundry"` // Linux specific numbers // https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-proc-meminfo.html // https://www.kernel.org/doc/Documentation/filesystems/proc.txt // https://www.kernel.org/doc/Documentation/vm/overcommit-accounting Buffers uint64 `json:"buffers"` Cached uint64 `json:"cached"` Writeback uint64 `json:"writeback"` Dirty uint64 `json:"dirty"` WritebackTmp uint64 `json:"writebacktmp"` Slab uint64 `json:"slab"` SReclaimable uint64 `json:"sreclaimable"` SUnreclaim uint64 `json:"sunreclaim"` PageTables uint64 `json:"pagetables"` SwapCached uint64 `json:"swapcached"` CommitLimit uint64 `json:"commitlimit"` CommittedAS uint64 `json:"committedas"` HighTotal uint64 `json:"hightotal"` HighFree uint64 `json:"highfree"` LowTotal uint64 `json:"lowtotal"` LowFree uint64 `json:"lowfree"` SwapTotal uint64 `json:"swaptotal"` SwapFree uint64 `json:"swapfree"` Mapped uint64 `json:"mapped"` VMallocTotal uint64 `json:"vmalloctotal"` VMallocUsed uint64 `json:"vmallocused"` VMallocChunk uint64 `json:"vmallocchunk"` HugePagesTotal uint64 `json:"hugepagestotal"` HugePagesFree uint64 `json:"hugepagesfree"` HugePageSize uint64 `json:"hugepagesize"` }
VirtualMemoryStat holds commonly used memory measurements. We must have a local type here in order to avoid building the gopsutil library on certain arch types.
This struct is copied to maintain backwards compatibility in the Vault host-info API. This is done because gopsutil changed JSON struct tags between its v2 and v3 releases. For details see https://github.com/shirou/gopsutil/tree/master/_tools/v3migration.
func CollectHostMemory ¶ added in v1.8.0
func CollectHostMemory(ctx context.Context) (*VirtualMemoryStat, error)