...

Package procfs

import "github.com/prometheus/procfs"
Overview
Index
Subdirectories

Overview ▾

Package procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.

Example:

package main

import (
	"fmt"
	"log"

	"github.com/prometheus/procfs"
)

func main() {
	p, err := procfs.Self()
	if err != nil {
		log.Fatalf("could not get process: %s", err)
	}

	stat, err := p.Stat()
	if err != nil {
		log.Fatalf("could not get process stat: %s", err)
	}

	fmt.Printf("command:  %s\n", stat.Comm)
	fmt.Printf("cpu time: %fs\n", stat.CPUTime())
	fmt.Printf("vsize:    %dB\n", stat.VirtualMemory())
	fmt.Printf("rss:      %dB\n", stat.ResidentMemory())
}

Index ▾

Constants
Variables
type ARPEntry
    func (entry *ARPEntry) IsComplete() bool
type BuddyInfo
type CPUInfo
type CPUStat
type Cgroup
type CgroupSummary
type ConntrackStatEntry
type Crypto
type FS
    func NewDefaultFS() (FS, error)
    func NewFS(mountPoint string) (FS, error)
    func (fs FS) AllProcs() (Procs, error)
    func (fs FS) AllThreads(pid int) (Procs, error)
    func (fs FS) BuddyInfo() ([]BuddyInfo, error)
    func (fs FS) CPUInfo() ([]CPUInfo, error)
    func (fs FS) CgroupSummarys() ([]CgroupSummary, error)
    func (fs FS) CmdLine() ([]string, error)
    func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error)
    func (fs FS) Crypto() ([]Crypto, error)
    func (fs FS) Fscacheinfo() (Fscacheinfo, error)
    func (fs FS) GatherARPEntries() ([]ARPEntry, error)
    func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error)
    func (fs FS) IPVSStats() (IPVSStats, error)
    func (fs FS) KernelRandom() (KernelRandom, error)
    func (fs FS) LoadAvg() (*LoadAvg, error)
    func (fs FS) MDStat() ([]MDStat, error)
    func (fs FS) Meminfo() (Meminfo, error)
    func (fs FS) NetDev() (NetDev, error)
    func (fs FS) NetProtocols() (NetProtocolStats, error)
    func (fs FS) NetRoute() ([]NetRouteLine, error)
    func (fs FS) NetSockstat() (*NetSockstat, error)
    func (fs FS) NetSockstat6() (*NetSockstat, error)
    func (fs FS) NetSoftnetStat() ([]SoftnetStat, error)
    func (fs FS) NetStat() ([]NetStat, error)
    func (fs FS) NetTCP() (NetTCP, error)
    func (fs FS) NetTCP6() (NetTCP, error)
    func (fs FS) NetTCP6Summary() (*NetTCPSummary, error)
    func (fs FS) NetTCPSummary() (*NetTCPSummary, error)
    func (fs FS) NetUDP() (NetUDP, error)
    func (fs FS) NetUDP6() (NetUDP, error)
    func (fs FS) NetUDP6Summary() (*NetUDPSummary, error)
    func (fs FS) NetUDPSummary() (*NetUDPSummary, error)
    func (fs FS) NetUNIX() (*NetUNIX, error)
    func (fs FS) NewProc(pid int) (Proc, error)
    func (fs FS) NewStat() (Stat, error)
    func (fs FS) NewTLSStat() (TLSStat, error)
    func (fs FS) NewXfrmStat() (XfrmStat, error)
    func (fs FS) PSIStatsForResource(resource string) (PSIStats, error)
    func (fs FS) Proc(pid int) (Proc, error)
    func (fs FS) Schedstat() (*Schedstat, error)
    func (fs FS) Self() (Proc, error)
    func (fs FS) SlabInfo() (SlabInfo, error)
    func (fs FS) Softirqs() (Softirqs, error)
    func (fs FS) Stat() (Stat, error)
    func (fs FS) Swaps() ([]*Swap, error)
    func (fs FS) SysctlInts(sysctl string) ([]int, error)
    func (fs FS) SysctlStrings(sysctl string) ([]string, error)
    func (fs FS) Thread(pid, tid int) (Proc, error)
    func (fs FS) VM() (*VM, error)
    func (fs FS) Wireless() ([]*Wireless, error)
    func (fs FS) Zoneinfo() ([]Zoneinfo, error)
type Fscacheinfo
type IPVSBackendStatus
type IPVSStats
type Icmp
type Icmp6
type IcmpMsg
type InotifyInfo
type Interrupt
type Interrupts
type Ip
type Ip6
type IpExt
type KernelRandom
type LoadAvg
type MDStat
type Meminfo
type Mount
type MountInfo
    func GetMounts() ([]*MountInfo, error)
    func GetProcMounts(pid int) ([]*MountInfo, error)
type MountStats
type MountStatsNFS
type NFSBytesStats
type NFSEventsStats
type NFSOperationStats
type NFSTransportStats
type Namespace
type Namespaces
type NetDev
    func (netDev NetDev) Total() NetDevLine
type NetDevLine
type NetIPSocket
type NetIPSocketSummary
type NetProtocolCapabilities
type NetProtocolStatLine
type NetProtocolStats
type NetRouteLine
type NetSockstat
type NetSockstatProtocol
type NetStat
type NetTCP
type NetTCPSummary
type NetUDP
type NetUDPSummary
type NetUNIX
type NetUNIXFlags
    func (f NetUNIXFlags) String() string
type NetUNIXLine
type NetUNIXState
    func (s NetUNIXState) String() string
type NetUNIXType
    func (t NetUNIXType) String() string
type PSILine
type PSIStats
type Proc
    func NewProc(pid int) (Proc, error)
    func Self() (Proc, error)
    func (p Proc) Cgroups() ([]Cgroup, error)
    func (p Proc) CmdLine() ([]string, error)
    func (p Proc) Comm() (string, error)
    func (p Proc) Cwd() (string, error)
    func (p Proc) Environ() ([]string, error)
    func (p Proc) Executable() (string, error)
    func (p Proc) FDInfo(fd string) (*ProcFDInfo, error)
    func (p Proc) FileDescriptorTargets() ([]string, error)
    func (p Proc) FileDescriptors() ([]uintptr, error)
    func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error)
    func (p Proc) FileDescriptorsLen() (int, error)
    func (p Proc) IO() (ProcIO, error)
    func (p Proc) Interrupts() (Interrupts, error)
    func (p Proc) Limits() (ProcLimits, error)
    func (p Proc) MountInfo() ([]*MountInfo, error)
    func (p Proc) MountStats() ([]*Mount, error)
    func (p Proc) Namespaces() (Namespaces, error)
    func (p Proc) NetDev() (NetDev, error)
    func (p Proc) Netstat() (ProcNetstat, error)
    func (p Proc) NewLimits() (ProcLimits, error)
    func (p Proc) NewStat() (ProcStat, error)
    func (p Proc) NewStatus() (ProcStatus, error)
    func (p Proc) ProcMaps() ([]*ProcMap, error)
    func (p Proc) ProcSMapsRollup() (ProcSMapsRollup, error)
    func (p Proc) RootDir() (string, error)
    func (p Proc) Schedstat() (ProcSchedstat, error)
    func (p Proc) Snmp() (ProcSnmp, error)
    func (p Proc) Snmp6() (ProcSnmp6, error)
    func (p Proc) Stat() (ProcStat, error)
    func (proc Proc) Thread(tid int) (Proc, error)
    func (p Proc) Wchan() (string, error)
type ProcFDInfo
type ProcFDInfos
    func (p ProcFDInfos) InotifyWatchLen() (int, error)
    func (p ProcFDInfos) Len() int
    func (p ProcFDInfos) Less(i, j int) bool
    func (p ProcFDInfos) Swap(i, j int)
type ProcIO
type ProcLimits
type ProcMap
type ProcMapPermissions
type ProcNetstat
type ProcSMapsRollup
type ProcSchedstat
type ProcSnmp
type ProcSnmp6
type ProcStat
    func (s ProcStat) CPUTime() float64
    func (s ProcStat) ResidentMemory() int
    func (s ProcStat) StartTime() (float64, error)
    func (s ProcStat) VirtualMemory() uint
type ProcStatus
    func (s ProcStatus) TotalCtxtSwitches() uint64
type Procs
    func AllProcs() (Procs, error)
    func AllThreads(pid int) (Procs, error)
    func (p Procs) Len() int
    func (p Procs) Less(i, j int) bool
    func (p Procs) Swap(i, j int)
type Schedstat
type SchedstatCPU
type Slab
type SlabInfo
type SoftIRQStat
type Softirqs
type SoftnetStat
type Stat
    func NewStat() (Stat, error)
type Swap
type TLSStat
    func NewTLSStat() (TLSStat, error)
type Tcp
type TcpExt
type Udp
type Udp6
type UdpLite
type UdpLite6
type VM
type Wireless
type XfrmStat
    func NewXfrmStat() (XfrmStat, error)
type Zoneinfo

Package files

arp.go buddyinfo.go cmdline.go cpuinfo.go cpuinfo_x86.go crypto.go doc.go fs.go fs_statfs_type.go fscache.go ipvs.go kernel_random.go loadavg.go mdstat.go meminfo.go mountinfo.go mountstats.go net_conntrackstat.go net_dev.go net_ip_socket.go net_protocols.go net_route.go net_sockstat.go net_softnet.go net_tcp.go net_tls_stat.go net_udp.go net_unix.go net_wireless.go net_xfrm.go netstat.go proc.go proc_cgroup.go proc_cgroups.go proc_environ.go proc_fdinfo.go proc_interrupts.go proc_io.go proc_limits.go proc_maps.go proc_netstat.go proc_ns.go proc_psi.go proc_smaps.go proc_snmp.go proc_snmp6.go proc_stat.go proc_status.go proc_sys.go schedstat.go slab.go softirqs.go stat.go swaps.go thread.go vm.go zoneinfo.go

Constants

Learned from include/uapi/linux/if_arp.h.

const (
    // completed entry (ha valid).
    ATFComplete = 0x02
    // permanent entry.
    ATFPermanent = 0x04
    // Publish entry.
    ATFPublish = 0x08
    // Has requested trailers.
    ATFUseTrailers = 0x10
    // Obsoleted: Want to use a netmask (only for proxy entries).
    ATFNetmask = 0x20
    // Don't answer this addresses.
    ATFDontPublish = 0x40
)

DefaultMountPoint is the common mount point of the proc filesystem.

const DefaultMountPoint = fs.DefaultProcMountPoint

Variables

var (
    ErrFileParse  = errors.New("Error Parsing File")
    ErrFileRead   = errors.New("Error Reading File")
    ErrMountPoint = errors.New("Error Accessing Mount point")
)

type ARPEntry

ARPEntry contains a single row of the columnar data represented in /proc/net/arp.

type ARPEntry struct {
    // IP address
    IPAddr net.IP
    // MAC address
    HWAddr net.HardwareAddr
    // Name of the device
    Device string
    // Flags
    Flags byte
}

func (*ARPEntry) IsComplete

func (entry *ARPEntry) IsComplete() bool

IsComplete returns true if ARP entry is marked with complete flag.

type BuddyInfo

A BuddyInfo is the details parsed from /proc/buddyinfo. The data is comprised of an array of free fragments of each size. The sizes are 2^n*PAGE_SIZE, where n is the array index.

type BuddyInfo struct {
    Node  string
    Zone  string
    Sizes []float64
}

type CPUInfo

CPUInfo contains general information about a system CPU found in /proc/cpuinfo.

type CPUInfo struct {
    Processor       uint
    VendorID        string
    CPUFamily       string
    Model           string
    ModelName       string
    Stepping        string
    Microcode       string
    CPUMHz          float64
    CacheSize       string
    PhysicalID      string
    Siblings        uint
    CoreID          string
    CPUCores        uint
    APICID          string
    InitialAPICID   string
    FPU             string
    FPUException    string
    CPUIDLevel      uint
    WP              string
    Flags           []string
    Bugs            []string
    BogoMips        float64
    CLFlushSize     uint
    CacheAlignment  uint
    AddressSizes    string
    PowerManagement string
}

type CPUStat

CPUStat shows how much time the cpu spend in various stages.

type CPUStat struct {
    User      float64
    Nice      float64
    System    float64
    Idle      float64
    Iowait    float64
    IRQ       float64
    SoftIRQ   float64
    Steal     float64
    Guest     float64
    GuestNice float64
}

type Cgroup

Cgroup models one line from /proc/[pid]/cgroup. Each Cgroup struct describes the placement of a PID inside a specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. v1 has one hierarchy per available resource controller, while v2 has one unified hierarchy shared by all controllers. Regardless of v1 or v2, all hierarchies contain all running processes, so the question answerable with a Cgroup struct is 'where is this process in this hierarchy' (where==what path on the specific cgroupfs). By prefixing this path with the mount point of *this specific* hierarchy, you can locate the relevant pseudo-files needed to read/set the data for this PID in this hierarchy

Also see http://man7.org/linux/man-pages/man7/cgroups.7.html

type Cgroup struct {
    // HierarchyID that can be matched to a named hierarchy using /proc/cgroups. Cgroups V2 only has one
    // hierarchy, so HierarchyID is always 0. For cgroups v1 this is a unique ID number
    HierarchyID int
    // Controllers using this hierarchy of processes. Controllers are also known as subsystems. For
    // Cgroups V2 this may be empty, as all active controllers use the same hierarchy
    Controllers []string
    // Path of this control group, relative to the mount point of the cgroupfs representing this specific
    // hierarchy
    Path string
}

type CgroupSummary

CgroupSummary models one line from /proc/cgroups. This file contains information about the controllers that are compiled into the kernel.

Also see http://man7.org/linux/man-pages/man7/cgroups.7.html

type CgroupSummary struct {
    // The name of the controller. controller is also known as subsystem.
    SubsysName string
    // The unique ID of the cgroup hierarchy on which this controller is mounted.
    Hierarchy int
    // The number of control groups in this hierarchy using this controller.
    Cgroups int
    // This field contains the value 1 if this controller is enabled, or 0 if it has been disabled
    Enabled int
}

type ConntrackStatEntry

A ConntrackStatEntry represents one line from net/stat/nf_conntrack and contains netfilter conntrack statistics at one CPU core.

type ConntrackStatEntry struct {
    Entries       uint64
    Searched      uint64
    Found         uint64
    New           uint64
    Invalid       uint64
    Ignore        uint64
    Delete        uint64
    DeleteList    uint64
    Insert        uint64
    InsertFailed  uint64
    Drop          uint64
    EarlyDrop     uint64
    SearchRestart uint64
}

type Crypto

Crypto holds info parsed from /proc/crypto.

type Crypto struct {
    Alignmask   *uint64
    Async       bool
    Blocksize   *uint64
    Chunksize   *uint64
    Ctxsize     *uint64
    Digestsize  *uint64
    Driver      string
    Geniv       string
    Internal    string
    Ivsize      *uint64
    Maxauthsize *uint64
    MaxKeysize  *uint64
    MinKeysize  *uint64
    Module      string
    Name        string
    Priority    *int64
    Refcnt      *int64
    Seedsize    *uint64
    Selftest    string
    Type        string
    Walksize    *uint64
}

type FS

FS represents the pseudo-filesystem sys, which provides an interface to kernel data structures.

type FS struct {
    // contains filtered or unexported fields
}

func NewDefaultFS

func NewDefaultFS() (FS, error)

NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. It will error if the mount point directory can't be read or is a file.

func NewFS

func NewFS(mountPoint string) (FS, error)

NewFS returns a new proc FS mounted under the given proc mountPoint. It will error if the mount point directory can't be read or is a file.

func (FS) AllProcs

func (fs FS) AllProcs() (Procs, error)

AllProcs returns a list of all currently available processes.

func (FS) AllThreads

func (fs FS) AllThreads(pid int) (Procs, error)

AllThreads returns a list of all currently available threads for PID.

func (FS) BuddyInfo

func (fs FS) BuddyInfo() ([]BuddyInfo, error)

BuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem.

func (FS) CPUInfo

func (fs FS) CPUInfo() ([]CPUInfo, error)

CPUInfo returns information about current system CPUs. See https://www.kernel.org/doc/Documentation/filesystems/proc.txt

func (FS) CgroupSummarys

func (fs FS) CgroupSummarys() ([]CgroupSummary, error)

CgroupSummarys returns information about current /proc/cgroups.

func (FS) CmdLine

func (fs FS) CmdLine() ([]string, error)

CmdLine returns the command line of the kernel.

func (FS) ConntrackStat

func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error)

ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores.

func (FS) Crypto

func (fs FS) Crypto() ([]Crypto, error)

Crypto parses an crypto-file (/proc/crypto) and returns a slice of structs containing the relevant info. More information available here: https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html

func (FS) Fscacheinfo

func (fs FS) Fscacheinfo() (Fscacheinfo, error)

Fscacheinfo returns information about current fscache statistics. See https://www.kernel.org/doc/Documentation/filesystems/caching/fscache.txt

func (FS) GatherARPEntries

func (fs FS) GatherARPEntries() ([]ARPEntry, error)

GatherARPEntries retrieves all the ARP entries, parse the relevant columns, and then return a slice of ARPEntry's.

func (FS) IPVSBackendStatus

func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error)

IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.

func (FS) IPVSStats

func (fs FS) IPVSStats() (IPVSStats, error)

IPVSStats reads the IPVS statistics from the specified `proc` filesystem.

func (FS) KernelRandom

func (fs FS) KernelRandom() (KernelRandom, error)

KernelRandom returns values from /proc/sys/kernel/random.

func (FS) LoadAvg

func (fs FS) LoadAvg() (*LoadAvg, error)

LoadAvg returns loadavg from /proc.

func (FS) MDStat

func (fs FS) MDStat() ([]MDStat, error)

MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of structs containing the relevant info. More information available here: https://raid.wiki.kernel.org/index.php/Mdstat

func (FS) Meminfo

func (fs FS) Meminfo() (Meminfo, error)

Meminfo returns an information about current kernel/system memory statistics. See https://www.kernel.org/doc/Documentation/filesystems/proc.txt

func (FS) NetDev

func (fs FS) NetDev() (NetDev, error)

NetDev returns kernel/system statistics read from /proc/net/dev.

func (FS) NetProtocols

func (fs FS) NetProtocols() (NetProtocolStats, error)

NetProtocols reads stats from /proc/net/protocols and returns a map of PortocolStatLine entries. As of this writing no official Linux Documentation exists, however the source is fairly self-explanatory and the format seems stable since its introduction in 2.6.12-rc2 Linux 2.6.12-rc2 - https://elixir.bootlin.com/linux/v2.6.12-rc2/source/net/core/sock.c#L1452 Linux 5.10 - https://elixir.bootlin.com/linux/v5.10.4/source/net/core/sock.c#L3586

func (FS) NetRoute

func (fs FS) NetRoute() ([]NetRouteLine, error)

func (FS) NetSockstat

func (fs FS) NetSockstat() (*NetSockstat, error)

NetSockstat retrieves IPv4 socket statistics.

func (FS) NetSockstat6

func (fs FS) NetSockstat6() (*NetSockstat, error)

NetSockstat6 retrieves IPv6 socket statistics.

If IPv6 is disabled on this kernel, the returned error can be checked with os.IsNotExist.

func (FS) NetSoftnetStat

func (fs FS) NetSoftnetStat() ([]SoftnetStat, error)

NetSoftnetStat reads data from /proc/net/softnet_stat.

func (FS) NetStat

func (fs FS) NetStat() ([]NetStat, error)

NetStat retrieves stats from `/proc/net/stat/`.

func (FS) NetTCP

func (fs FS) NetTCP() (NetTCP, error)

NetTCP returns the IPv4 kernel/networking statistics for TCP datagrams read from /proc/net/tcp.

func (FS) NetTCP6

func (fs FS) NetTCP6() (NetTCP, error)

NetTCP6 returns the IPv6 kernel/networking statistics for TCP datagrams read from /proc/net/tcp6.

func (FS) NetTCP6Summary

func (fs FS) NetTCP6Summary() (*NetTCPSummary, error)

NetTCP6Summary returns already computed statistics like the total queue lengths for TCP datagrams read from /proc/net/tcp6.

func (FS) NetTCPSummary

func (fs FS) NetTCPSummary() (*NetTCPSummary, error)

NetTCPSummary returns already computed statistics like the total queue lengths for TCP datagrams read from /proc/net/tcp.

func (FS) NetUDP

func (fs FS) NetUDP() (NetUDP, error)

NetUDP returns the IPv4 kernel/networking statistics for UDP datagrams read from /proc/net/udp.

func (FS) NetUDP6

func (fs FS) NetUDP6() (NetUDP, error)

NetUDP6 returns the IPv6 kernel/networking statistics for UDP datagrams read from /proc/net/udp6.

func (FS) NetUDP6Summary

func (fs FS) NetUDP6Summary() (*NetUDPSummary, error)

NetUDP6Summary returns already computed statistics like the total queue lengths for UDP datagrams read from /proc/net/udp6.

func (FS) NetUDPSummary

func (fs FS) NetUDPSummary() (*NetUDPSummary, error)

NetUDPSummary returns already computed statistics like the total queue lengths for UDP datagrams read from /proc/net/udp.

func (FS) NetUNIX

func (fs FS) NetUNIX() (*NetUNIX, error)

NetUNIX returns data read from /proc/net/unix.

func (FS) NewProc

func (fs FS) NewProc(pid int) (Proc, error)

NewProc returns a process for the given pid.

Deprecated: Use fs.Proc() instead.

func (FS) NewStat

func (fs FS) NewStat() (Stat, error)

NewStat returns information about current cpu/process statistics. See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Deprecated: Use fs.Stat() instead.

func (FS) NewTLSStat

func (fs FS) NewTLSStat() (TLSStat, error)

NewTLSStat reads the tls_stat statistics.

func (FS) NewXfrmStat

func (fs FS) NewXfrmStat() (XfrmStat, error)

NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem.

func (FS) PSIStatsForResource

func (fs FS) PSIStatsForResource(resource string) (PSIStats, error)

PSIStatsForResource reads pressure stall information for the specified resource from /proc/pressure/<resource>. At time of writing this can be either "cpu", "memory" or "io".

func (FS) Proc

func (fs FS) Proc(pid int) (Proc, error)

Proc returns a process for the given pid.

func (FS) Schedstat

func (fs FS) Schedstat() (*Schedstat, error)

Schedstat reads data from `/proc/schedstat`.

func (FS) Self

func (fs FS) Self() (Proc, error)

Self returns a process for the current process.

func (FS) SlabInfo

func (fs FS) SlabInfo() (SlabInfo, error)

SlabInfo reads data from `/proc/slabinfo`.

func (FS) Softirqs

func (fs FS) Softirqs() (Softirqs, error)

func (FS) Stat

func (fs FS) Stat() (Stat, error)

Stat returns information about current cpu/process statistics. See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

func (FS) Swaps

func (fs FS) Swaps() ([]*Swap, error)

Swaps returns a slice of all configured swap devices on the system.

func (FS) SysctlInts

func (fs FS) SysctlInts(sysctl string) ([]int, error)

func (FS) SysctlStrings

func (fs FS) SysctlStrings(sysctl string) ([]string, error)

func (FS) Thread

func (fs FS) Thread(pid, tid int) (Proc, error)

Thread returns a process for a given PID, TID.

func (FS) VM

func (fs FS) VM() (*VM, error)

VM reads the VM statistics from the specified `proc` filesystem.

func (FS) Wireless

func (fs FS) Wireless() ([]*Wireless, error)

Wireless returns kernel wireless statistics.

func (FS) Zoneinfo

func (fs FS) Zoneinfo() ([]Zoneinfo, error)

Zoneinfo parses an zoneinfo-file (/proc/zoneinfo) and returns a slice of structs containing the relevant info. More information available here: https://www.kernel.org/doc/Documentation/sysctl/vm.txt

type Fscacheinfo

Fscacheinfo represents fscache statistics.

type Fscacheinfo struct {
    // Number of index cookies allocated
    IndexCookiesAllocated uint64
    // data storage cookies allocated
    DataStorageCookiesAllocated uint64
    // Number of special cookies allocated
    SpecialCookiesAllocated uint64
    // Number of objects allocated
    ObjectsAllocated uint64
    // Number of object allocation failures
    ObjectAllocationsFailure uint64
    // Number of objects that reached the available state
    ObjectsAvailable uint64
    // Number of objects that reached the dead state
    ObjectsDead uint64
    // Number of objects that didn't have a coherency check
    ObjectsWithoutCoherencyCheck uint64
    // Number of objects that passed a coherency check
    ObjectsWithCoherencyCheck uint64
    // Number of objects that needed a coherency data update
    ObjectsNeedCoherencyCheckUpdate uint64
    // Number of objects that were declared obsolete
    ObjectsDeclaredObsolete uint64
    // Number of pages marked as being cached
    PagesMarkedAsBeingCached uint64
    // Number of uncache page requests seen
    UncachePagesRequestSeen uint64
    // Number of acquire cookie requests seen
    AcquireCookiesRequestSeen uint64
    // Number of acq reqs given a NULL parent
    AcquireRequestsWithNullParent uint64
    // Number of acq reqs rejected due to no cache available
    AcquireRequestsRejectedNoCacheAvailable uint64
    // Number of acq reqs succeeded
    AcquireRequestsSucceeded uint64
    // Number of acq reqs rejected due to error
    AcquireRequestsRejectedDueToError uint64
    // Number of acq reqs failed on ENOMEM
    AcquireRequestsFailedDueToEnomem uint64
    // Number of lookup calls made on cache backends
    LookupsNumber uint64
    // Number of negative lookups made
    LookupsNegative uint64
    // Number of positive lookups made
    LookupsPositive uint64
    // Number of objects created by lookup
    ObjectsCreatedByLookup uint64
    // Number of lookups timed out and requeued
    LookupsTimedOutAndRequed uint64
    InvalidationsNumber      uint64
    InvalidationsRunning     uint64
    // Number of update cookie requests seen
    UpdateCookieRequestSeen uint64
    // Number of upd reqs given a NULL parent
    UpdateRequestsWithNullParent uint64
    // Number of upd reqs granted CPU time
    UpdateRequestsRunning uint64
    // Number of relinquish cookie requests seen
    RelinquishCookiesRequestSeen uint64
    // Number of rlq reqs given a NULL parent
    RelinquishCookiesWithNullParent uint64
    // Number of rlq reqs waited on completion of creation
    RelinquishRequestsWaitingCompleteCreation uint64
    // Relinqs rtr
    RelinquishRetries uint64
    // Number of attribute changed requests seen
    AttributeChangedRequestsSeen uint64
    // Number of attr changed requests queued
    AttributeChangedRequestsQueued uint64
    // Number of attr changed rejected -ENOBUFS
    AttributeChangedRejectDueToEnobufs uint64
    // Number of attr changed failed -ENOMEM
    AttributeChangedFailedDueToEnomem uint64
    // Number of attr changed ops given CPU time
    AttributeChangedOps uint64
    // Number of allocation requests seen
    AllocationRequestsSeen uint64
    // Number of successful alloc reqs
    AllocationOkRequests uint64
    // Number of alloc reqs that waited on lookup completion
    AllocationWaitingOnLookup uint64
    // Number of alloc reqs rejected -ENOBUFS
    AllocationsRejectedDueToEnobufs uint64
    // Number of alloc reqs aborted -ERESTARTSYS
    AllocationsAbortedDueToErestartsys uint64
    // Number of alloc reqs submitted
    AllocationOperationsSubmitted uint64
    // Number of alloc reqs waited for CPU time
    AllocationsWaitedForCPU uint64
    // Number of alloc reqs aborted due to object death
    AllocationsAbortedDueToObjectDeath uint64
    // Number of retrieval (read) requests seen
    RetrievalsReadRequests uint64
    // Number of successful retr reqs
    RetrievalsOk uint64
    // Number of retr reqs that waited on lookup completion
    RetrievalsWaitingLookupCompletion uint64
    // Number of retr reqs returned -ENODATA
    RetrievalsReturnedEnodata uint64
    // Number of retr reqs rejected -ENOBUFS
    RetrievalsRejectedDueToEnobufs uint64
    // Number of retr reqs aborted -ERESTARTSYS
    RetrievalsAbortedDueToErestartsys uint64
    // Number of retr reqs failed -ENOMEM
    RetrievalsFailedDueToEnomem uint64
    // Number of retr reqs submitted
    RetrievalsRequests uint64
    // Number of retr reqs waited for CPU time
    RetrievalsWaitingCPU uint64
    // Number of retr reqs aborted due to object death
    RetrievalsAbortedDueToObjectDeath uint64
    // Number of storage (write) requests seen
    StoreWriteRequests uint64
    // Number of successful store reqs
    StoreSuccessfulRequests uint64
    // Number of store reqs on a page already pending storage
    StoreRequestsOnPendingStorage uint64
    // Number of store reqs rejected -ENOBUFS
    StoreRequestsRejectedDueToEnobufs uint64
    // Number of store reqs failed -ENOMEM
    StoreRequestsFailedDueToEnomem uint64
    // Number of store reqs submitted
    StoreRequestsSubmitted uint64
    // Number of store reqs granted CPU time
    StoreRequestsRunning uint64
    // Number of pages given store req processing time
    StorePagesWithRequestsProcessing uint64
    // Number of store reqs deleted from tracking tree
    StoreRequestsDeleted uint64
    // Number of store reqs over store limit
    StoreRequestsOverStoreLimit uint64
    // Number of release reqs against pages with no pending store
    ReleaseRequestsAgainstPagesWithNoPendingStorage uint64
    // Number of release reqs against pages stored by time lock granted
    ReleaseRequestsAgainstPagesStoredByTimeLockGranted uint64
    // Number of release reqs ignored due to in-progress store
    ReleaseRequestsIgnoredDueToInProgressStore uint64
    // Number of page stores cancelled due to release req
    PageStoresCancelledByReleaseRequests uint64
    VmscanWaiting                        uint64
    // Number of times async ops added to pending queues
    OpsPending uint64
    // Number of times async ops given CPU time
    OpsRunning uint64
    // Number of times async ops queued for processing
    OpsEnqueued uint64
    // Number of async ops cancelled
    OpsCancelled uint64
    // Number of async ops rejected due to object lookup/create failure
    OpsRejected uint64
    // Number of async ops initialised
    OpsInitialised uint64
    // Number of async ops queued for deferred release
    OpsDeferred uint64
    // Number of async ops released (should equal ini=N when idle)
    OpsReleased uint64
    // Number of deferred-release async ops garbage collected
    OpsGarbageCollected uint64
    // Number of in-progress alloc_object() cache ops
    CacheopAllocationsinProgress uint64
    // Number of in-progress lookup_object() cache ops
    CacheopLookupObjectInProgress uint64
    // Number of in-progress lookup_complete() cache ops
    CacheopLookupCompleteInPorgress uint64
    // Number of in-progress grab_object() cache ops
    CacheopGrabObjectInProgress uint64
    CacheopInvalidations        uint64
    // Number of in-progress update_object() cache ops
    CacheopUpdateObjectInProgress uint64
    // Number of in-progress drop_object() cache ops
    CacheopDropObjectInProgress uint64
    // Number of in-progress put_object() cache ops
    CacheopPutObjectInProgress uint64
    // Number of in-progress attr_changed() cache ops
    CacheopAttributeChangeInProgress uint64
    // Number of in-progress sync_cache() cache ops
    CacheopSyncCacheInProgress uint64
    // Number of in-progress read_or_alloc_page() cache ops
    CacheopReadOrAllocPageInProgress uint64
    // Number of in-progress read_or_alloc_pages() cache ops
    CacheopReadOrAllocPagesInProgress uint64
    // Number of in-progress allocate_page() cache ops
    CacheopAllocatePageInProgress uint64
    // Number of in-progress allocate_pages() cache ops
    CacheopAllocatePagesInProgress uint64
    // Number of in-progress write_page() cache ops
    CacheopWritePagesInProgress uint64
    // Number of in-progress uncache_page() cache ops
    CacheopUncachePagesInProgress uint64
    // Number of in-progress dissociate_pages() cache ops
    CacheopDissociatePagesInProgress uint64
    // Number of object lookups/creations rejected due to lack of space
    CacheevLookupsAndCreationsRejectedLackSpace uint64
    // Number of stale objects deleted
    CacheevStaleObjectsDeleted uint64
    // Number of objects retired when relinquished
    CacheevRetiredWhenReliquished uint64
    // Number of objects culled
    CacheevObjectsCulled uint64
}

type IPVSBackendStatus

IPVSBackendStatus holds current metrics of one virtual / real address pair.

type IPVSBackendStatus struct {
    // The local (virtual) IP address.
    LocalAddress net.IP
    // The remote (real) IP address.
    RemoteAddress net.IP
    // The local (virtual) port.
    LocalPort uint16
    // The remote (real) port.
    RemotePort uint16
    // The local firewall mark
    LocalMark string
    // The transport protocol (TCP, UDP).
    Proto string
    // The current number of active connections for this virtual/real address pair.
    ActiveConn uint64
    // The current number of inactive connections for this virtual/real address pair.
    InactConn uint64
    // The current weight of this virtual/real address pair.
    Weight uint64
}

type IPVSStats

IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.

type IPVSStats struct {
    // Total count of connections.
    Connections uint64
    // Total incoming packages processed.
    IncomingPackets uint64
    // Total outgoing packages processed.
    OutgoingPackets uint64
    // Total incoming traffic.
    IncomingBytes uint64
    // Total outgoing traffic.
    OutgoingBytes uint64
}

type Icmp

type Icmp struct {
    InMsgs           *float64
    InErrors         *float64
    InCsumErrors     *float64
    InDestUnreachs   *float64
    InTimeExcds      *float64
    InParmProbs      *float64
    InSrcQuenchs     *float64
    InRedirects      *float64
    InEchos          *float64
    InEchoReps       *float64
    InTimestamps     *float64
    InTimestampReps  *float64
    InAddrMasks      *float64
    InAddrMaskReps   *float64
    OutMsgs          *float64
    OutErrors        *float64
    OutDestUnreachs  *float64
    OutTimeExcds     *float64
    OutParmProbs     *float64
    OutSrcQuenchs    *float64
    OutRedirects     *float64
    OutEchos         *float64
    OutEchoReps      *float64
    OutTimestamps    *float64
    OutTimestampReps *float64
    OutAddrMasks     *float64
    OutAddrMaskReps  *float64
}

type Icmp6

type Icmp6 struct {
    InMsgs                    *float64
    InErrors                  *float64
    OutMsgs                   *float64
    OutErrors                 *float64
    InCsumErrors              *float64
    InDestUnreachs            *float64
    InPktTooBigs              *float64
    InTimeExcds               *float64
    InParmProblems            *float64
    InEchos                   *float64
    InEchoReplies             *float64
    InGroupMembQueries        *float64
    InGroupMembResponses      *float64
    InGroupMembReductions     *float64
    InRouterSolicits          *float64
    InRouterAdvertisements    *float64
    InNeighborSolicits        *float64
    InNeighborAdvertisements  *float64
    InRedirects               *float64
    InMLDv2Reports            *float64
    OutDestUnreachs           *float64
    OutPktTooBigs             *float64
    OutTimeExcds              *float64
    OutParmProblems           *float64
    OutEchos                  *float64
    OutEchoReplies            *float64
    OutGroupMembQueries       *float64
    OutGroupMembResponses     *float64
    OutGroupMembReductions    *float64
    OutRouterSolicits         *float64
    OutRouterAdvertisements   *float64
    OutNeighborSolicits       *float64
    OutNeighborAdvertisements *float64
    OutRedirects              *float64
    OutMLDv2Reports           *float64
    InType1                   *float64
    InType134                 *float64
    InType135                 *float64
    InType136                 *float64
    InType143                 *float64
    OutType133                *float64
    OutType135                *float64
    OutType136                *float64
    OutType143                *float64
}

type IcmpMsg

type IcmpMsg struct {
    InType3  *float64
    OutType3 *float64
}

type InotifyInfo

InotifyInfo represents a single inotify line in the fdinfo file.

type InotifyInfo struct {
    // Watch descriptor number
    WD string
    // Inode number
    Ino string
    // Device ID
    Sdev string
    // Mask of events being monitored
    Mask string
}

type Interrupt

Interrupt represents a single interrupt line.

type Interrupt struct {
    // Info is the type of interrupt.
    Info string
    // Devices is the name of the device that is located at that IRQ
    Devices string
    // Values is the number of interrupts per CPU.
    Values []string
}

type Interrupts

Interrupts models the content of /proc/interrupts. Key is the IRQ number. - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-interrupts - https://raspberrypi.stackexchange.com/questions/105802/explanation-of-proc-interrupts-output

type Interrupts map[string]Interrupt

type Ip

type Ip struct {
    Forwarding      *float64
    DefaultTTL      *float64
    InReceives      *float64
    InHdrErrors     *float64
    InAddrErrors    *float64
    ForwDatagrams   *float64
    InUnknownProtos *float64
    InDiscards      *float64
    InDelivers      *float64
    OutRequests     *float64
    OutDiscards     *float64
    OutNoRoutes     *float64
    ReasmTimeout    *float64
    ReasmReqds      *float64
    ReasmOKs        *float64
    ReasmFails      *float64
    FragOKs         *float64
    FragFails       *float64
    FragCreates     *float64
}

type Ip6

type Ip6 struct {
    InReceives       *float64
    InHdrErrors      *float64
    InTooBigErrors   *float64
    InNoRoutes       *float64
    InAddrErrors     *float64
    InUnknownProtos  *float64
    InTruncatedPkts  *float64
    InDiscards       *float64
    InDelivers       *float64
    OutForwDatagrams *float64
    OutRequests      *float64
    OutDiscards      *float64
    OutNoRoutes      *float64
    ReasmTimeout     *float64
    ReasmReqds       *float64
    ReasmOKs         *float64
    ReasmFails       *float64
    FragOKs          *float64
    FragFails        *float64
    FragCreates      *float64
    InMcastPkts      *float64
    OutMcastPkts     *float64
    InOctets         *float64
    OutOctets        *float64
    InMcastOctets    *float64
    OutMcastOctets   *float64
    InBcastOctets    *float64
    OutBcastOctets   *float64
    InNoECTPkts      *float64
    InECT1Pkts       *float64
    InECT0Pkts       *float64
    InCEPkts         *float64
}

type IpExt

type IpExt struct {
    InNoRoutes      *float64
    InTruncatedPkts *float64
    InMcastPkts     *float64
    OutMcastPkts    *float64
    InBcastPkts     *float64
    OutBcastPkts    *float64
    InOctets        *float64
    OutOctets       *float64
    InMcastOctets   *float64
    OutMcastOctets  *float64
    InBcastOctets   *float64
    OutBcastOctets  *float64
    InCsumErrors    *float64
    InNoECTPkts     *float64
    InECT1Pkts      *float64
    InECT0Pkts      *float64
    InCEPkts        *float64
    ReasmOverlaps   *float64
}

type KernelRandom

KernelRandom contains information about to the kernel's random number generator.

type KernelRandom struct {
    // EntropyAvaliable gives the available entropy, in bits.
    EntropyAvaliable *uint64
    // PoolSize gives the size of the entropy pool, in bits.
    PoolSize *uint64
    // URandomMinReseedSeconds is the number of seconds after which the DRNG will be reseeded.
    URandomMinReseedSeconds *uint64
    // WriteWakeupThreshold the number of bits of entropy below which we wake up processes
    // that do a select(2) or poll(2) for write access to /dev/random.
    WriteWakeupThreshold *uint64
    // ReadWakeupThreshold is the number of bits of entropy required for waking up processes that sleep
    // waiting for entropy from /dev/random.
    ReadWakeupThreshold *uint64
}

type LoadAvg

LoadAvg represents an entry in /proc/loadavg.

type LoadAvg struct {
    Load1  float64
    Load5  float64
    Load15 float64
}

type MDStat

MDStat holds info parsed from /proc/mdstat.

type MDStat struct {
    // Name of the device.
    Name string
    // activity-state of the device.
    ActivityState string
    // Number of active disks.
    DisksActive int64
    // Total number of disks the device requires.
    DisksTotal int64
    // Number of failed disks.
    DisksFailed int64
    // Number of "down" disks. (the _ indicator in the status line)
    DisksDown int64
    // Spare disks in the device.
    DisksSpare int64
    // Number of blocks the device holds.
    BlocksTotal int64
    // Number of blocks on the device that are in sync.
    BlocksSynced int64
    // progress percentage of current sync
    BlocksSyncedPct float64
    // estimated finishing time for current sync (in minutes)
    BlocksSyncedFinishTime float64
    // current sync speed (in Kilobytes/sec)
    BlocksSyncedSpeed float64
    // Name of md component devices
    Devices []string
}

type Meminfo

Meminfo represents memory statistics.

type Meminfo struct {
    // Total usable ram (i.e. physical ram minus a few reserved
    // bits and the kernel binary code)
    MemTotal *uint64
    // The sum of LowFree+HighFree
    MemFree *uint64
    // An estimate of how much memory is available for starting
    // new applications, without swapping. Calculated from
    // MemFree, SReclaimable, the size of the file LRU lists, and
    // the low watermarks in each zone.  The estimate takes into
    // account that the system needs some page cache to function
    // well, and that not all reclaimable slab will be
    // reclaimable, due to items being in use. The impact of those
    // factors will vary from system to system.
    MemAvailable *uint64
    // Relatively temporary storage for raw disk blocks shouldn't
    // get tremendously large (20MB or so)
    Buffers *uint64
    Cached  *uint64
    // Memory that once was swapped out, is swapped back in but
    // still also is in the swapfile (if memory is needed it
    // doesn't need to be swapped out AGAIN because it is already
    // in the swapfile. This saves I/O)
    SwapCached *uint64
    // Memory that has been used more recently and usually not
    // reclaimed unless absolutely necessary.
    Active *uint64
    // Memory which has been less recently used.  It is more
    // eligible to be reclaimed for other purposes
    Inactive     *uint64
    ActiveAnon   *uint64
    InactiveAnon *uint64
    ActiveFile   *uint64
    InactiveFile *uint64
    Unevictable  *uint64
    Mlocked      *uint64
    // total amount of swap space available
    SwapTotal *uint64
    // Memory which has been evicted from RAM, and is temporarily
    // on the disk
    SwapFree *uint64
    // Memory which is waiting to get written back to the disk
    Dirty *uint64
    // Memory which is actively being written back to the disk
    Writeback *uint64
    // Non-file backed pages mapped into userspace page tables
    AnonPages *uint64
    // files which have been mapped, such as libraries
    Mapped *uint64
    Shmem  *uint64
    // in-kernel data structures cache
    Slab *uint64
    // Part of Slab, that might be reclaimed, such as caches
    SReclaimable *uint64
    // Part of Slab, that cannot be reclaimed on memory pressure
    SUnreclaim  *uint64
    KernelStack *uint64
    // amount of memory dedicated to the lowest level of page
    // tables.
    PageTables *uint64
    // NFS pages sent to the server, but not yet committed to
    // stable storage
    NFSUnstable *uint64
    // Memory used for block device "bounce buffers"
    Bounce *uint64
    // Memory used by FUSE for temporary writeback buffers
    WritebackTmp *uint64
    // Based on the overcommit ratio ('vm.overcommit_ratio'),
    // this is the total amount of  memory currently available to
    // be allocated on the system. This limit is only adhered to
    // if strict overcommit accounting is enabled (mode 2 in
    // 'vm.overcommit_memory').
    // The CommitLimit is calculated with the following formula:
    // CommitLimit = ([total RAM pages] - [total huge TLB pages]) *
    //                overcommit_ratio / 100 + [total swap pages]
    // For example, on a system with 1G of physical RAM and 7G
    // of swap with a `vm.overcommit_ratio` of 30 it would
    // yield a CommitLimit of 7.3G.
    // For more details, see the memory overcommit documentation
    // in vm/overcommit-accounting.
    CommitLimit *uint64
    // The amount of memory presently allocated on the system.
    // The committed memory is a sum of all of the memory which
    // has been allocated by processes, even if it has not been
    // "used" by them as of yet. A process which malloc()'s 1G
    // of memory, but only touches 300M of it will show up as
    // using 1G. This 1G is memory which has been "committed" to
    // by the VM and can be used at any time by the allocating
    // application. With strict overcommit enabled on the system
    // (mode 2 in 'vm.overcommit_memory'),allocations which would
    // exceed the CommitLimit (detailed above) will not be permitted.
    // This is useful if one needs to guarantee that processes will
    // not fail due to lack of memory once that memory has been
    // successfully allocated.
    CommittedAS *uint64
    // total size of vmalloc memory area
    VmallocTotal *uint64
    // amount of vmalloc area which is used
    VmallocUsed *uint64
    // largest contiguous block of vmalloc area which is free
    VmallocChunk      *uint64
    Percpu            *uint64
    HardwareCorrupted *uint64
    AnonHugePages     *uint64
    ShmemHugePages    *uint64
    ShmemPmdMapped    *uint64
    CmaTotal          *uint64
    CmaFree           *uint64
    HugePagesTotal    *uint64
    HugePagesFree     *uint64
    HugePagesRsvd     *uint64
    HugePagesSurp     *uint64
    Hugepagesize      *uint64
    DirectMap4k       *uint64
    DirectMap2M       *uint64
    DirectMap1G       *uint64

    // The struct fields below are the byte-normalized counterparts to the
    // existing struct fields. Values are normalized using the optional
    // unit field in the meminfo line.
    MemTotalBytes          *uint64
    MemFreeBytes           *uint64
    MemAvailableBytes      *uint64
    BuffersBytes           *uint64
    CachedBytes            *uint64
    SwapCachedBytes        *uint64
    ActiveBytes            *uint64
    InactiveBytes          *uint64
    ActiveAnonBytes        *uint64
    InactiveAnonBytes      *uint64
    ActiveFileBytes        *uint64
    InactiveFileBytes      *uint64
    UnevictableBytes       *uint64
    MlockedBytes           *uint64
    SwapTotalBytes         *uint64
    SwapFreeBytes          *uint64
    DirtyBytes             *uint64
    WritebackBytes         *uint64
    AnonPagesBytes         *uint64
    MappedBytes            *uint64
    ShmemBytes             *uint64
    SlabBytes              *uint64
    SReclaimableBytes      *uint64
    SUnreclaimBytes        *uint64
    KernelStackBytes       *uint64
    PageTablesBytes        *uint64
    NFSUnstableBytes       *uint64
    BounceBytes            *uint64
    WritebackTmpBytes      *uint64
    CommitLimitBytes       *uint64
    CommittedASBytes       *uint64
    VmallocTotalBytes      *uint64
    VmallocUsedBytes       *uint64
    VmallocChunkBytes      *uint64
    PercpuBytes            *uint64
    HardwareCorruptedBytes *uint64
    AnonHugePagesBytes     *uint64
    ShmemHugePagesBytes    *uint64
    ShmemPmdMappedBytes    *uint64
    CmaTotalBytes          *uint64
    CmaFreeBytes           *uint64
    HugepagesizeBytes      *uint64
    DirectMap4kBytes       *uint64
    DirectMap2MBytes       *uint64
    DirectMap1GBytes       *uint64
}

type Mount

A Mount is a device mount parsed from /proc/[pid]/mountstats.

type Mount struct {
    // Name of the device.
    Device string
    // The mount point of the device.
    Mount string
    // The filesystem type used by the device.
    Type string
    // If available additional statistics related to this Mount.
    // Use a type assertion to determine if additional statistics are available.
    Stats MountStats
}

type MountInfo

A MountInfo is a type that describes the details, options for each mount, parsed from /proc/self/mountinfo. The fields described in each entry of /proc/self/mountinfo is described in the following man page. http://man7.org/linux/man-pages/man5/proc.5.html

type MountInfo struct {
    // Unique ID for the mount
    MountID int
    // The ID of the parent mount
    ParentID int
    // The value of `st_dev` for the files on this FS
    MajorMinorVer string
    // The pathname of the directory in the FS that forms
    // the root for this mount
    Root string
    // The pathname of the mount point relative to the root
    MountPoint string
    // Mount options
    Options map[string]string
    // Zero or more optional fields
    OptionalFields map[string]string
    // The Filesystem type
    FSType string
    // FS specific information or "none"
    Source string
    // Superblock options
    SuperOptions map[string]string
}

func GetMounts

func GetMounts() ([]*MountInfo, error)

GetMounts retrieves mountinfo information from `/proc/self/mountinfo`.

func GetProcMounts

func GetProcMounts(pid int) ([]*MountInfo, error)

GetProcMounts retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`.

type MountStats

A MountStats is a type which contains detailed statistics for a specific type of Mount.

type MountStats interface {
    // contains filtered or unexported methods
}

type MountStatsNFS

A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts.

type MountStatsNFS struct {
    // The version of statistics provided.
    StatVersion string
    // The mount options of the NFS mount.
    Opts map[string]string
    // The age of the NFS mount.
    Age time.Duration
    // Statistics related to byte counters for various operations.
    Bytes NFSBytesStats
    // Statistics related to various NFS event occurrences.
    Events NFSEventsStats
    // Statistics broken down by filesystem operation.
    Operations []NFSOperationStats
    // Statistics about the NFS RPC transport.
    Transport NFSTransportStats
}

type NFSBytesStats

A NFSBytesStats contains statistics about the number of bytes read and written by an NFS client to and from an NFS server.

type NFSBytesStats struct {
    // Number of bytes read using the read() syscall.
    Read uint64
    // Number of bytes written using the write() syscall.
    Write uint64
    // Number of bytes read using the read() syscall in O_DIRECT mode.
    DirectRead uint64
    // Number of bytes written using the write() syscall in O_DIRECT mode.
    DirectWrite uint64
    // Number of bytes read from the NFS server, in total.
    ReadTotal uint64
    // Number of bytes written to the NFS server, in total.
    WriteTotal uint64
    // Number of pages read directly via mmap()'d files.
    ReadPages uint64
    // Number of pages written directly via mmap()'d files.
    WritePages uint64
}

type NFSEventsStats

A NFSEventsStats contains statistics about NFS event occurrences.

type NFSEventsStats struct {
    // Number of times cached inode attributes are re-validated from the server.
    InodeRevalidate uint64
    // Number of times cached dentry nodes are re-validated from the server.
    DnodeRevalidate uint64
    // Number of times an inode cache is cleared.
    DataInvalidate uint64
    // Number of times cached inode attributes are invalidated.
    AttributeInvalidate uint64
    // Number of times files or directories have been open()'d.
    VFSOpen uint64
    // Number of times a directory lookup has occurred.
    VFSLookup uint64
    // Number of times permissions have been checked.
    VFSAccess uint64
    // Number of updates (and potential writes) to pages.
    VFSUpdatePage uint64
    // Number of pages read directly via mmap()'d files.
    VFSReadPage uint64
    // Number of times a group of pages have been read.
    VFSReadPages uint64
    // Number of pages written directly via mmap()'d files.
    VFSWritePage uint64
    // Number of times a group of pages have been written.
    VFSWritePages uint64
    // Number of times directory entries have been read with getdents().
    VFSGetdents uint64
    // Number of times attributes have been set on inodes.
    VFSSetattr uint64
    // Number of pending writes that have been forcefully flushed to the server.
    VFSFlush uint64
    // Number of times fsync() has been called on directories and files.
    VFSFsync uint64
    // Number of times locking has been attempted on a file.
    VFSLock uint64
    // Number of times files have been closed and released.
    VFSFileRelease uint64
    // Unknown.  Possibly unused.
    CongestionWait uint64
    // Number of times files have been truncated.
    Truncation uint64
    // Number of times a file has been grown due to writes beyond its existing end.
    WriteExtension uint64
    // Number of times a file was removed while still open by another process.
    SillyRename uint64
    // Number of times the NFS server gave less data than expected while reading.
    ShortRead uint64
    // Number of times the NFS server wrote less data than expected while writing.
    ShortWrite uint64
    // Number of times the NFS server indicated EJUKEBOX; retrieving data from
    // offline storage.
    JukeboxDelay uint64
    // Number of NFS v4.1+ pNFS reads.
    PNFSRead uint64
    // Number of NFS v4.1+ pNFS writes.
    PNFSWrite uint64
}

type NFSOperationStats

A NFSOperationStats contains statistics for a single operation.

type NFSOperationStats struct {
    // The name of the operation.
    Operation string
    // Number of requests performed for this operation.
    Requests uint64
    // Number of times an actual RPC request has been transmitted for this operation.
    Transmissions uint64
    // Number of times a request has had a major timeout.
    MajorTimeouts uint64
    // Number of bytes sent for this operation, including RPC headers and payload.
    BytesSent uint64
    // Number of bytes received for this operation, including RPC headers and payload.
    BytesReceived uint64
    // Duration all requests spent queued for transmission before they were sent.
    CumulativeQueueMilliseconds uint64
    // Duration it took to get a reply back after the request was transmitted.
    CumulativeTotalResponseMilliseconds uint64
    // Duration from when a request was enqueued to when it was completely handled.
    CumulativeTotalRequestMilliseconds uint64
    // The average time from the point the client sends RPC requests until it receives the response.
    AverageRTTMilliseconds float64
    // The count of operations that complete with tk_status < 0.  These statuses usually indicate error conditions.
    Errors uint64
}

type NFSTransportStats

A NFSTransportStats contains statistics for the NFS mount RPC requests and responses.

type NFSTransportStats struct {
    // The transport protocol used for the NFS mount.
    Protocol string
    // The local port used for the NFS mount.
    Port uint64
    // Number of times the client has had to establish a connection from scratch
    // to the NFS server.
    Bind uint64
    // Number of times the client has made a TCP connection to the NFS server.
    Connect uint64
    // Duration (in jiffies, a kernel internal unit of time) the NFS mount has
    // spent waiting for connections to the server to be established.
    ConnectIdleTime uint64
    // Duration since the NFS mount last saw any RPC traffic.
    IdleTimeSeconds uint64
    // Number of RPC requests for this mount sent to the NFS server.
    Sends uint64
    // Number of RPC responses for this mount received from the NFS server.
    Receives uint64
    // Number of times the NFS server sent a response with a transaction ID
    // unknown to this client.
    BadTransactionIDs uint64
    // A running counter, incremented on each request as the current difference
    // ebetween sends and receives.
    CumulativeActiveRequests uint64
    // A running counter, incremented on each request by the current backlog
    // queue size.
    CumulativeBacklog uint64

    // Maximum number of simultaneously active RPC requests ever used.
    MaximumRPCSlotsUsed uint64
    // A running counter, incremented on each request as the current size of the
    // sending queue.
    CumulativeSendingQueue uint64
    // A running counter, incremented on each request as the current size of the
    // pending queue.
    CumulativePendingQueue uint64

    // accessed when sending a call
    ReadChunkCount   uint64
    WriteChunkCount  uint64
    ReplyChunkCount  uint64
    TotalRdmaRequest uint64

    // rarely accessed error counters
    PullupCopyCount      uint64
    HardwayRegisterCount uint64
    FailedMarshalCount   uint64
    BadReplyCount        uint64
    MrsRecovered         uint64
    MrsOrphaned          uint64
    MrsAllocated         uint64
    EmptySendctxQ        uint64

    // accessed when receiving a reply
    TotalRdmaReply    uint64
    FixupCopyCount    uint64
    ReplyWaitsForSend uint64
    LocalInvNeeded    uint64
    NomsgCallCount    uint64
    BcallCount        uint64
}

type Namespace

Namespace represents a single namespace of a process.

type Namespace struct {
    Type  string // Namespace type.
    Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match.
}

type Namespaces

Namespaces contains all of the namespaces that the process is contained in.

type Namespaces map[string]Namespace

type NetDev

NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys are interface names.

type NetDev map[string]NetDevLine

func (NetDev) Total

func (netDev NetDev) Total() NetDevLine

Total aggregates the values across interfaces and returns a new NetDevLine. The Name field will be a sorted comma separated list of interface names.

type NetDevLine

NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.

type NetDevLine struct {
    Name         string `json:"name"`          // The name of the interface.
    RxBytes      uint64 `json:"rx_bytes"`      // Cumulative count of bytes received.
    RxPackets    uint64 `json:"rx_packets"`    // Cumulative count of packets received.
    RxErrors     uint64 `json:"rx_errors"`     // Cumulative count of receive errors encountered.
    RxDropped    uint64 `json:"rx_dropped"`    // Cumulative count of packets dropped while receiving.
    RxFIFO       uint64 `json:"rx_fifo"`       // Cumulative count of FIFO buffer errors.
    RxFrame      uint64 `json:"rx_frame"`      // Cumulative count of packet framing errors.
    RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
    RxMulticast  uint64 `json:"rx_multicast"`  // Cumulative count of multicast frames received by the device driver.
    TxBytes      uint64 `json:"tx_bytes"`      // Cumulative count of bytes transmitted.
    TxPackets    uint64 `json:"tx_packets"`    // Cumulative count of packets transmitted.
    TxErrors     uint64 `json:"tx_errors"`     // Cumulative count of transmit errors encountered.
    TxDropped    uint64 `json:"tx_dropped"`    // Cumulative count of packets dropped while transmitting.
    TxFIFO       uint64 `json:"tx_fifo"`       // Cumulative count of FIFO buffer errors.
    TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
    TxCarrier    uint64 `json:"tx_carrier"`    // Cumulative count of carrier losses detected by the device driver.
    TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
}

type NetIPSocket

NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header.

type NetIPSocket []*netIPSocketLine

type NetIPSocketSummary

NetIPSocketSummary provides already computed values like the total queue lengths or the total number of used sockets. In contrast to NetIPSocket it does not collect the parsed lines into a slice.

type NetIPSocketSummary struct {
    // TxQueueLength shows the total queue length of all parsed tx_queue lengths.
    TxQueueLength uint64
    // RxQueueLength shows the total queue length of all parsed rx_queue lengths.
    RxQueueLength uint64
    // UsedSockets shows the total number of parsed lines representing the
    // number of used sockets.
    UsedSockets uint64
    // Drops shows the total number of dropped packets of all UPD sockets.
    Drops *uint64
}

type NetProtocolCapabilities

NetProtocolCapabilities contains a list of capabilities for each protocol.

type NetProtocolCapabilities struct {
    Close               bool // 8
    Connect             bool // 9
    Disconnect          bool // 10
    Accept              bool // 11
    IoCtl               bool // 12
    Init                bool // 13
    Destroy             bool // 14
    Shutdown            bool // 15
    SetSockOpt          bool // 16
    GetSockOpt          bool // 17
    SendMsg             bool // 18
    RecvMsg             bool // 19
    SendPage            bool // 20
    Bind                bool // 21
    BacklogRcv          bool // 22
    Hash                bool // 23
    UnHash              bool // 24
    GetPort             bool // 25
    EnterMemoryPressure bool // 26
}

type NetProtocolStatLine

NetProtocolStatLine contains a single line parsed from /proc/net/protocols. We only care about the first six columns as the rest are not likely to change and only serve to provide a set of capabilities for each protocol.

type NetProtocolStatLine struct {
    Name         string // 0 The name of the protocol
    Size         uint64 // 1 The size, in bytes, of a given protocol structure. e.g. sizeof(struct tcp_sock) or sizeof(struct unix_sock)
    Sockets      int64  // 2 Number of sockets in use by this protocol
    Memory       int64  // 3 Number of 4KB pages allocated by all sockets of this protocol
    Pressure     int    // 4 This is either yes, no, or NI (not implemented). For the sake of simplicity we treat NI as not experiencing memory pressure.
    MaxHeader    uint64 // 5 Protocol specific max header size
    Slab         bool   // 6 Indicates whether or not memory is allocated from the SLAB
    ModuleName   string // 7 The name of the module that implemented this protocol or "kernel" if not from a module
    Capabilities NetProtocolCapabilities
}

type NetProtocolStats

NetProtocolStats stores the contents from /proc/net/protocols.

type NetProtocolStats map[string]NetProtocolStatLine

type NetRouteLine

A NetRouteLine represents one line from net/route.

type NetRouteLine struct {
    Iface       string
    Destination uint32
    Gateway     uint32
    Flags       uint32
    RefCnt      uint32
    Use         uint32
    Metric      uint32
    Mask        uint32
    MTU         uint32
    Window      uint32
    IRTT        uint32
}

type NetSockstat

A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6, respectively.

type NetSockstat struct {
    // Used is non-nil for IPv4 sockstat results, but nil for IPv6.
    Used      *int
    Protocols []NetSockstatProtocol
}

type NetSockstatProtocol

A NetSockstatProtocol contains statistics about a given socket protocol. Pointer fields indicate that the value may or may not be present on any given protocol.

type NetSockstatProtocol struct {
    Protocol string
    InUse    int
    Orphan   *int
    TW       *int
    Alloc    *int
    Mem      *int
    Memory   *int
}

type NetStat

NetStat contains statistics for all the counters from one file.

type NetStat struct {
    Stats    map[string][]uint64
    Filename string
}

type NetTCP

NetTCP represents the contents of /proc/net/tcp{,6} file without the header.

type NetTCP []*netIPSocketLine

type NetTCPSummary

NetTCPSummary provides already computed values like the total queue lengths or the total number of used sockets. In contrast to NetTCP it does not collect the parsed lines into a slice.

type NetTCPSummary NetIPSocketSummary

type NetUDP

NetUDP represents the contents of /proc/net/udp{,6} file without the header.

type NetUDP []*netIPSocketLine

type NetUDPSummary

NetUDPSummary provides already computed values like the total queue lengths or the total number of used sockets. In contrast to NetUDP it does not collect the parsed lines into a slice.

type NetUDPSummary NetIPSocketSummary

type NetUNIX

NetUNIX holds the data read from /proc/net/unix.

type NetUNIX struct {
    Rows []*NetUNIXLine
}

type NetUNIXFlags

NetUNIXFlags is the type of the flags field.

type NetUNIXFlags uint64

func (NetUNIXFlags) String

func (f NetUNIXFlags) String() string

type NetUNIXLine

NetUNIXLine represents a line of /proc/net/unix.

type NetUNIXLine struct {
    KernelPtr string
    RefCount  uint64
    Protocol  uint64
    Flags     NetUNIXFlags
    Type      NetUNIXType
    State     NetUNIXState
    Inode     uint64
    Path      string
}

type NetUNIXState

NetUNIXState is the type of the state field.

type NetUNIXState uint64

func (NetUNIXState) String

func (s NetUNIXState) String() string

type NetUNIXType

NetUNIXType is the type of the type field.

type NetUNIXType uint64

func (NetUNIXType) String

func (t NetUNIXType) String() string

type PSILine

PSILine is a single line of values as returned by `/proc/pressure/*`.

The Avg entries are averages over n seconds, as a percentage. The Total line is in microseconds.

type PSILine struct {
    Avg10  float64
    Avg60  float64
    Avg300 float64
    Total  uint64
}

type PSIStats

PSIStats represent pressure stall information from /proc/pressure/*

"Some" indicates the share of time in which at least some tasks are stalled. "Full" indicates the share of time in which all non-idle tasks are stalled simultaneously.

type PSIStats struct {
    Some *PSILine
    Full *PSILine
}

type Proc

Proc provides information about a running process.

type Proc struct {
    // The process ID.
    PID int
    // contains filtered or unexported fields
}

func NewProc

func NewProc(pid int) (Proc, error)

NewProc returns a process for the given pid under /proc.

func Self

func Self() (Proc, error)

Self returns a process for the current process read via /proc/self.

func (Proc) Cgroups

func (p Proc) Cgroups() ([]Cgroup, error)

Cgroups reads from /proc/<pid>/cgroups and returns a []*Cgroup struct locating this PID in each process control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes, so the len of the returned struct is equal to the number of active hierarchies on this system.

func (Proc) CmdLine

func (p Proc) CmdLine() ([]string, error)

CmdLine returns the command line of a process.

func (Proc) Comm

func (p Proc) Comm() (string, error)

Comm returns the command name of a process.

func (Proc) Cwd

func (p Proc) Cwd() (string, error)

Cwd returns the absolute path to the current working directory of the process.

func (Proc) Environ

func (p Proc) Environ() ([]string, error)

Environ reads process environments from `/proc/<pid>/environ`.

func (Proc) Executable

func (p Proc) Executable() (string, error)

Executable returns the absolute path of the executable command of a process.

func (Proc) FDInfo

func (p Proc) FDInfo(fd string) (*ProcFDInfo, error)

FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty.

func (Proc) FileDescriptorTargets

func (p Proc) FileDescriptorTargets() ([]string, error)

FileDescriptorTargets returns the targets of all file descriptors of a process. If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.

func (Proc) FileDescriptors

func (p Proc) FileDescriptors() ([]uintptr, error)

FileDescriptors returns the currently open file descriptors of a process.

func (Proc) FileDescriptorsInfo

func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error)

FileDescriptorsInfo retrieves information about all file descriptors of the process.

func (Proc) FileDescriptorsLen

func (p Proc) FileDescriptorsLen() (int, error)

FileDescriptorsLen returns the number of currently open file descriptors of a process.

func (Proc) IO

func (p Proc) IO() (ProcIO, error)

IO creates a new ProcIO instance from a given Proc instance.

func (Proc) Interrupts

func (p Proc) Interrupts() (Interrupts, error)

Interrupts creates a new instance from a given Proc instance.

func (Proc) Limits

func (p Proc) Limits() (ProcLimits, error)

Limits returns the current soft limits of the process.

func (Proc) MountInfo

func (p Proc) MountInfo() ([]*MountInfo, error)

MountInfo retrieves mount information for mount points in a process's namespace. It supplies information missing in `/proc/self/mounts` and fixes various other problems with that file too.

func (Proc) MountStats

func (p Proc) MountStats() ([]*Mount, error)

MountStats retrieves statistics and configuration for mount points in a process's namespace.

func (Proc) Namespaces

func (p Proc) Namespaces() (Namespaces, error)

Namespaces reads from /proc/<pid>/ns/* to get the namespaces of which the process is a member.

func (Proc) NetDev

func (p Proc) NetDev() (NetDev, error)

NetDev returns kernel/system statistics read from /proc/[pid]/net/dev.

func (Proc) Netstat

func (p Proc) Netstat() (ProcNetstat, error)

func (Proc) NewLimits

func (p Proc) NewLimits() (ProcLimits, error)

NewLimits returns the current soft limits of the process.

Deprecated: Use p.Limits() instead.

func (Proc) NewStat

func (p Proc) NewStat() (ProcStat, error)

NewStat returns the current status information of the process.

Deprecated: Use p.Stat() instead.

func (Proc) NewStatus

func (p Proc) NewStatus() (ProcStatus, error)

NewStatus returns the current status information of the process.

func (Proc) ProcMaps

func (p Proc) ProcMaps() ([]*ProcMap, error)

ProcMaps reads from /proc/[pid]/maps to get the memory-mappings of the process.

func (Proc) ProcSMapsRollup

func (p Proc) ProcSMapsRollup() (ProcSMapsRollup, error)

ProcSMapsRollup reads from /proc/[pid]/smaps_rollup to get summed memory information of the process.

If smaps_rollup does not exists (require kernel >= 4.15), the content of /proc/pid/smaps will we read and summed.

func (Proc) RootDir

func (p Proc) RootDir() (string, error)

RootDir returns the absolute path to the process's root directory (as set by chroot).

func (Proc) Schedstat

func (p Proc) Schedstat() (ProcSchedstat, error)

Schedstat returns task scheduling information for the process.

func (Proc) Snmp

func (p Proc) Snmp() (ProcSnmp, error)

func (Proc) Snmp6

func (p Proc) Snmp6() (ProcSnmp6, error)

func (Proc) Stat

func (p Proc) Stat() (ProcStat, error)

Stat returns the current status information of the process.

func (Proc) Thread

func (proc Proc) Thread(tid int) (Proc, error)

Thread returns a process for a given TID of Proc.

func (Proc) Wchan

func (p Proc) Wchan() (string, error)

Wchan returns the wchan (wait channel) of a process.

type ProcFDInfo

ProcFDInfo contains represents file descriptor information.

type ProcFDInfo struct {
    // File descriptor
    FD string
    // File offset
    Pos string
    // File access mode and status flags
    Flags string
    // Mount point ID
    MntID string
    // Inode number
    Ino string
    // List of inotify lines (structured) in the fdinfo file (kernel 3.8+ only)
    InotifyInfos []InotifyInfo
}

type ProcFDInfos

ProcFDInfos represents a list of ProcFDInfo structs.

type ProcFDInfos []ProcFDInfo

func (ProcFDInfos) InotifyWatchLen

func (p ProcFDInfos) InotifyWatchLen() (int, error)

InotifyWatchLen returns the total number of inotify watches.

func (ProcFDInfos) Len

func (p ProcFDInfos) Len() int

func (ProcFDInfos) Less

func (p ProcFDInfos) Less(i, j int) bool

func (ProcFDInfos) Swap

func (p ProcFDInfos) Swap(i, j int)

type ProcIO

ProcIO models the content of /proc/<pid>/io.

type ProcIO struct {
    // Chars read.
    RChar uint64
    // Chars written.
    WChar uint64
    // Read syscalls.
    SyscR uint64
    // Write syscalls.
    SyscW uint64
    // Bytes read.
    ReadBytes uint64
    // Bytes written.
    WriteBytes uint64
    // Bytes written, but taking into account truncation. See
    // Documentation/filesystems/proc.txt in the kernel sources for
    // detailed explanation.
    CancelledWriteBytes int64
}

type ProcLimits

ProcLimits represents the soft limits for each of the process's resource limits. For more information see getrlimit(2): http://man7.org/linux/man-pages/man2/getrlimit.2.html.

type ProcLimits struct {
    // CPU time limit in seconds.
    CPUTime uint64
    // Maximum size of files that the process may create.
    FileSize uint64
    // Maximum size of the process's data segment (initialized data,
    // uninitialized data, and heap).
    DataSize uint64
    // Maximum size of the process stack in bytes.
    StackSize uint64
    // Maximum size of a core file.
    CoreFileSize uint64
    // Limit of the process's resident set in pages.
    ResidentSet uint64
    // Maximum number of processes that can be created for the real user ID of
    // the calling process.
    Processes uint64
    // Value one greater than the maximum file descriptor number that can be
    // opened by this process.
    OpenFiles uint64
    // Maximum number of bytes of memory that may be locked into RAM.
    LockedMemory uint64
    // Maximum size of the process's virtual memory address space in bytes.
    AddressSpace uint64
    // Limit on the combined number of flock(2) locks and fcntl(2) leases that
    // this process may establish.
    FileLocks uint64
    // Limit of signals that may be queued for the real user ID of the calling
    // process.
    PendingSignals uint64
    // Limit on the number of bytes that can be allocated for POSIX message
    // queues for the real user ID of the calling process.
    MsqqueueSize uint64
    // Limit of the nice priority set using setpriority(2) or nice(2).
    NicePriority uint64
    // Limit of the real-time priority set using sched_setscheduler(2) or
    // sched_setparam(2).
    RealtimePriority uint64
    // Limit (in microseconds) on the amount of CPU time that a process
    // scheduled under a real-time scheduling policy may consume without making
    // a blocking system call.
    RealtimeTimeout uint64
}

type ProcMap

ProcMap contains the process memory-mappings of the process read from `/proc/[pid]/maps`.

type ProcMap struct {
    // The start address of current mapping.
    StartAddr uintptr
    // The end address of the current mapping
    EndAddr uintptr
    // The permissions for this mapping
    Perms *ProcMapPermissions
    // The current offset into the file/fd (e.g., shared libs)
    Offset int64
    // Device owner of this mapping (major:minor) in Mkdev format.
    Dev uint64
    // The inode of the device above
    Inode uint64
    // The file or psuedofile (or empty==anonymous)
    Pathname string
}

type ProcMapPermissions

ProcMapPermissions contains permission settings read from `/proc/[pid]/maps`.

type ProcMapPermissions struct {
    // mapping has the [R]ead flag set
    Read bool
    // mapping has the [W]rite flag set
    Write bool
    // mapping has the [X]ecutable flag set
    Execute bool
    // mapping has the [S]hared flag set
    Shared bool
    // mapping is marked as [P]rivate (copy on write)
    Private bool
}

type ProcNetstat

ProcNetstat models the content of /proc/<pid>/net/netstat.

type ProcNetstat struct {
    // The process ID.
    PID int
    TcpExt
    IpExt
}

type ProcSMapsRollup

type ProcSMapsRollup struct {
    // Amount of the mapping that is currently resident in RAM.
    Rss uint64
    // Process's proportional share of this mapping.
    Pss uint64
    // Size in bytes of clean shared pages.
    SharedClean uint64
    // Size in bytes of dirty shared pages.
    SharedDirty uint64
    // Size in bytes of clean private pages.
    PrivateClean uint64
    // Size in bytes of dirty private pages.
    PrivateDirty uint64
    // Amount of memory currently marked as referenced or accessed.
    Referenced uint64
    // Amount of memory that does not belong to any file.
    Anonymous uint64
    // Amount would-be-anonymous memory currently on swap.
    Swap uint64
    // Process's proportional memory on swap.
    SwapPss uint64
}

type ProcSchedstat

ProcSchedstat contains the values from `/proc/<pid>/schedstat`.

type ProcSchedstat struct {
    RunningNanoseconds uint64
    WaitingNanoseconds uint64
    RunTimeslices      uint64
}

type ProcSnmp

ProcSnmp models the content of /proc/<pid>/net/snmp.

type ProcSnmp struct {
    // The process ID.
    PID int
    Ip
    Icmp
    IcmpMsg
    Tcp
    Udp
    UdpLite
}

type ProcSnmp6

ProcSnmp6 models the content of /proc/<pid>/net/snmp6.

type ProcSnmp6 struct {
    // The process ID.
    PID int
    Ip6
    Icmp6
    Udp6
    UdpLite6
}

type ProcStat

ProcStat provides status information about the process, read from /proc/[pid]/stat.

type ProcStat struct {
    // The process ID.
    PID int
    // The filename of the executable.
    Comm string
    // The process state.
    State string
    // The PID of the parent of this process.
    PPID int
    // The process group ID of the process.
    PGRP int
    // The session ID of the process.
    Session int
    // The controlling terminal of the process.
    TTY int
    // The ID of the foreground process group of the controlling terminal of
    // the process.
    TPGID int
    // The kernel flags word of the process.
    Flags uint
    // The number of minor faults the process has made which have not required
    // loading a memory page from disk.
    MinFlt uint
    // The number of minor faults that the process's waited-for children have
    // made.
    CMinFlt uint
    // The number of major faults the process has made which have required
    // loading a memory page from disk.
    MajFlt uint
    // The number of major faults that the process's waited-for children have
    // made.
    CMajFlt uint
    // Amount of time that this process has been scheduled in user mode,
    // measured in clock ticks.
    UTime uint
    // Amount of time that this process has been scheduled in kernel mode,
    // measured in clock ticks.
    STime uint
    // Amount of time that this process's waited-for children have been
    // scheduled in user mode, measured in clock ticks.
    CUTime int
    // Amount of time that this process's waited-for children have been
    // scheduled in kernel mode, measured in clock ticks.
    CSTime int
    // For processes running a real-time scheduling policy, this is the negated
    // scheduling priority, minus one.
    Priority int
    // The nice value, a value in the range 19 (low priority) to -20 (high
    // priority).
    Nice int
    // Number of threads in this process.
    NumThreads int
    // The time the process started after system boot, the value is expressed
    // in clock ticks.
    Starttime uint64
    // Virtual memory size in bytes.
    VSize uint
    // Resident set size in pages.
    RSS int
    // Soft limit in bytes on the rss of the process.
    RSSLimit uint64
    // CPU number last executed on.
    Processor uint
    // Real-time scheduling priority, a number in the range 1 to 99 for processes
    // scheduled under a real-time policy, or 0, for non-real-time processes.
    RTPriority uint
    // Scheduling policy.
    Policy uint
    // Aggregated block I/O delays, measured in clock ticks (centiseconds).
    DelayAcctBlkIOTicks uint64
    // Guest time of the process (time spent running a virtual CPU for a guest
    // operating system), measured in clock ticks.
    GuestTime int
    // Guest time of the process's children, measured in clock ticks.
    CGuestTime int
    // contains filtered or unexported fields
}

func (ProcStat) CPUTime

func (s ProcStat) CPUTime() float64

CPUTime returns the total CPU user and system time in seconds.

func (ProcStat) ResidentMemory

func (s ProcStat) ResidentMemory() int

ResidentMemory returns the resident memory size in bytes.

func (ProcStat) StartTime

func (s ProcStat) StartTime() (float64, error)

StartTime returns the unix timestamp of the process in seconds.

func (ProcStat) VirtualMemory

func (s ProcStat) VirtualMemory() uint

VirtualMemory returns the virtual memory size in bytes.

type ProcStatus

ProcStatus provides status information about the process, read from /proc/[pid]/status.

type ProcStatus struct {
    // The process ID.
    PID int
    // The process name.
    Name string

    // Thread group ID.
    TGID int
    // List of Pid namespace.
    NSpids []uint64

    // Peak virtual memory size.
    VmPeak uint64 // nolint:revive
    // Virtual memory size.
    VmSize uint64 // nolint:revive
    // Locked memory size.
    VmLck uint64 // nolint:revive
    // Pinned memory size.
    VmPin uint64 // nolint:revive
    // Peak resident set size.
    VmHWM uint64 // nolint:revive
    // Resident set size (sum of RssAnnon RssFile and RssShmem).
    VmRSS uint64 // nolint:revive
    // Size of resident anonymous memory.
    RssAnon uint64 // nolint:revive
    // Size of resident file mappings.
    RssFile uint64 // nolint:revive
    // Size of resident shared memory.
    RssShmem uint64 // nolint:revive
    // Size of data segments.
    VmData uint64 // nolint:revive
    // Size of stack segments.
    VmStk uint64 // nolint:revive
    // Size of text segments.
    VmExe uint64 // nolint:revive
    // Shared library code size.
    VmLib uint64 // nolint:revive
    // Page table entries size.
    VmPTE uint64 // nolint:revive
    // Size of second-level page tables.
    VmPMD uint64 // nolint:revive
    // Swapped-out virtual memory size by anonymous private.
    VmSwap uint64 // nolint:revive
    // Size of hugetlb memory portions
    HugetlbPages uint64

    // Number of voluntary context switches.
    VoluntaryCtxtSwitches uint64
    // Number of involuntary context switches.
    NonVoluntaryCtxtSwitches uint64

    // UIDs of the process (Real, effective, saved set, and filesystem UIDs)
    UIDs [4]string
    // GIDs of the process (Real, effective, saved set, and filesystem GIDs)
    GIDs [4]string

    // CpusAllowedList: List of cpu cores processes are allowed to run on.
    CpusAllowedList []uint64
}

func (ProcStatus) TotalCtxtSwitches

func (s ProcStatus) TotalCtxtSwitches() uint64

TotalCtxtSwitches returns the total context switch.

type Procs

Procs represents a list of Proc structs.

type Procs []Proc

func AllProcs

func AllProcs() (Procs, error)

AllProcs returns a list of all currently available processes under /proc.

func AllThreads

func AllThreads(pid int) (Procs, error)

AllThreads returns a list of all currently available threads under /proc/PID.

func (Procs) Len

func (p Procs) Len() int

func (Procs) Less

func (p Procs) Less(i, j int) bool

func (Procs) Swap

func (p Procs) Swap(i, j int)

type Schedstat

Schedstat contains scheduler statistics from /proc/schedstat

See https://www.kernel.org/doc/Documentation/scheduler/sched-stats.txt for a detailed description of what these numbers mean.

Note the current kernel documentation claims some of the time units are in jiffies when they are actually in nanoseconds since 2.6.23 with the introduction of CFS. A fix to the documentation is pending. See https://lore.kernel.org/patchwork/project/lkml/list/?series=403473

type Schedstat struct {
    CPUs []*SchedstatCPU
}

type SchedstatCPU

SchedstatCPU contains the values from one "cpu<N>" line.

type SchedstatCPU struct {
    CPUNum string

    RunningNanoseconds uint64
    WaitingNanoseconds uint64
    RunTimeslices      uint64
}

type Slab

Slab represents a slab pool in the kernel.

type Slab struct {
    Name         string
    ObjActive    int64
    ObjNum       int64
    ObjSize      int64
    ObjPerSlab   int64
    PagesPerSlab int64
    // tunables
    Limit        int64
    Batch        int64
    SharedFactor int64
    SlabActive   int64
    SlabNum      int64
    SharedAvail  int64
}

type SlabInfo

SlabInfo represents info for all slabs.

type SlabInfo struct {
    Slabs []*Slab
}

type SoftIRQStat

SoftIRQStat represent the softirq statistics as exported in the procfs stat file. A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html It is possible to get per-cpu stats by reading `/proc/softirqs`.

type SoftIRQStat struct {
    Hi          uint64
    Timer       uint64
    NetTx       uint64
    NetRx       uint64
    Block       uint64
    BlockIoPoll uint64
    Tasklet     uint64
    Sched       uint64
    Hrtimer     uint64
    Rcu         uint64
}

type Softirqs

Softirqs represents the softirq statistics.

type Softirqs struct {
    Hi      []uint64
    Timer   []uint64
    NetTx   []uint64
    NetRx   []uint64
    Block   []uint64
    IRQPoll []uint64
    Tasklet []uint64
    Sched   []uint64
    HRTimer []uint64
    RCU     []uint64
}

type SoftnetStat

SoftnetStat contains a single row of data from /proc/net/softnet_stat.

type SoftnetStat struct {
    // Number of processed packets.
    Processed uint32
    // Number of dropped packets.
    Dropped uint32
    // Number of times processing packets ran out of quota.
    TimeSqueezed uint32
    // Number of collision occur while obtaining device lock while transmitting.
    CPUCollision uint32
    // Number of times cpu woken up received_rps.
    ReceivedRps uint32
    // number of times flow limit has been reached.
    FlowLimitCount uint32
    // Softnet backlog status.
    SoftnetBacklogLen uint32
    // CPU id owning this softnet_data.
    Index uint32
    // softnet_data's Width.
    Width int
}

type Stat

Stat represents kernel/system statistics.

type Stat struct {
    // Boot time in seconds since the Epoch.
    BootTime uint64
    // Summed up cpu statistics.
    CPUTotal CPUStat
    // Per-CPU statistics.
    CPU map[int64]CPUStat
    // Number of times interrupts were handled, which contains numbered and unnumbered IRQs.
    IRQTotal uint64
    // Number of times a numbered IRQ was triggered.
    IRQ []uint64
    // Number of times a context switch happened.
    ContextSwitches uint64
    // Number of times a process was created.
    ProcessCreated uint64
    // Number of processes currently running.
    ProcessesRunning uint64
    // Number of processes currently blocked (waiting for IO).
    ProcessesBlocked uint64
    // Number of times a softirq was scheduled.
    SoftIRQTotal uint64
    // Detailed softirq statistics.
    SoftIRQ SoftIRQStat
}

func NewStat

func NewStat() (Stat, error)

NewStat returns information about current cpu/process statistics. See https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Deprecated: Use fs.Stat() instead.

type Swap

Swap represents an entry in /proc/swaps.

type Swap struct {
    Filename string
    Type     string
    Size     int
    Used     int
    Priority int
}

type TLSStat

TLSStat struct represents data in /proc/net/tls_stat. See https://docs.kernel.org/networking/tls.html#statistics

type TLSStat struct {
    // number of TX sessions currently installed where host handles cryptography
    TLSCurrTxSw int
    // number of RX sessions currently installed where host handles cryptography
    TLSCurrRxSw int
    // number of TX sessions currently installed where NIC handles cryptography
    TLSCurrTxDevice int
    // number of RX sessions currently installed where NIC handles cryptography
    TLSCurrRxDevice int
    //number of TX sessions opened with host cryptography
    TLSTxSw int
    //number of RX sessions opened with host cryptography
    TLSRxSw int
    // number of TX sessions opened with NIC cryptography
    TLSTxDevice int
    // number of RX sessions opened with NIC cryptography
    TLSRxDevice int
    // record decryption failed (e.g. due to incorrect authentication tag)
    TLSDecryptError int
    //  number of RX resyncs sent to NICs handling cryptography
    TLSRxDeviceResync int
    // number of RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction. Note that this counter will also increment for non-data records.
    TLSDecryptRetry int
    // number of data RX records which had to be re-decrypted due to TLS_RX_EXPECT_NO_PAD mis-prediction.
    TLSRxNoPadViolation int
}

func NewTLSStat

func NewTLSStat() (TLSStat, error)

NewTLSStat reads the tls_stat statistics.

type Tcp

type Tcp struct {
    RtoAlgorithm *float64
    RtoMin       *float64
    RtoMax       *float64
    MaxConn      *float64
    ActiveOpens  *float64
    PassiveOpens *float64
    AttemptFails *float64
    EstabResets  *float64
    CurrEstab    *float64
    InSegs       *float64
    OutSegs      *float64
    RetransSegs  *float64
    InErrs       *float64
    OutRsts      *float64
    InCsumErrors *float64
}

type TcpExt

type TcpExt struct {
    SyncookiesSent            *float64
    SyncookiesRecv            *float64
    SyncookiesFailed          *float64
    EmbryonicRsts             *float64
    PruneCalled               *float64
    RcvPruned                 *float64
    OfoPruned                 *float64
    OutOfWindowIcmps          *float64
    LockDroppedIcmps          *float64
    ArpFilter                 *float64
    TW                        *float64
    TWRecycled                *float64
    TWKilled                  *float64
    PAWSActive                *float64
    PAWSEstab                 *float64
    DelayedACKs               *float64
    DelayedACKLocked          *float64
    DelayedACKLost            *float64
    ListenOverflows           *float64
    ListenDrops               *float64
    TCPHPHits                 *float64
    TCPPureAcks               *float64
    TCPHPAcks                 *float64
    TCPRenoRecovery           *float64
    TCPSackRecovery           *float64
    TCPSACKReneging           *float64
    TCPSACKReorder            *float64
    TCPRenoReorder            *float64
    TCPTSReorder              *float64
    TCPFullUndo               *float64
    TCPPartialUndo            *float64
    TCPDSACKUndo              *float64
    TCPLossUndo               *float64
    TCPLostRetransmit         *float64
    TCPRenoFailures           *float64
    TCPSackFailures           *float64
    TCPLossFailures           *float64
    TCPFastRetrans            *float64
    TCPSlowStartRetrans       *float64
    TCPTimeouts               *float64
    TCPLossProbes             *float64
    TCPLossProbeRecovery      *float64
    TCPRenoRecoveryFail       *float64
    TCPSackRecoveryFail       *float64
    TCPRcvCollapsed           *float64
    TCPDSACKOldSent           *float64
    TCPDSACKOfoSent           *float64
    TCPDSACKRecv              *float64
    TCPDSACKOfoRecv           *float64
    TCPAbortOnData            *float64
    TCPAbortOnClose           *float64
    TCPAbortOnMemory          *float64
    TCPAbortOnTimeout         *float64
    TCPAbortOnLinger          *float64
    TCPAbortFailed            *float64
    TCPMemoryPressures        *float64
    TCPMemoryPressuresChrono  *float64
    TCPSACKDiscard            *float64
    TCPDSACKIgnoredOld        *float64
    TCPDSACKIgnoredNoUndo     *float64
    TCPSpuriousRTOs           *float64
    TCPMD5NotFound            *float64
    TCPMD5Unexpected          *float64
    TCPMD5Failure             *float64
    TCPSackShifted            *float64
    TCPSackMerged             *float64
    TCPSackShiftFallback      *float64
    TCPBacklogDrop            *float64
    PFMemallocDrop            *float64
    TCPMinTTLDrop             *float64
    TCPDeferAcceptDrop        *float64
    IPReversePathFilter       *float64
    TCPTimeWaitOverflow       *float64
    TCPReqQFullDoCookies      *float64
    TCPReqQFullDrop           *float64
    TCPRetransFail            *float64
    TCPRcvCoalesce            *float64
    TCPRcvQDrop               *float64
    TCPOFOQueue               *float64
    TCPOFODrop                *float64
    TCPOFOMerge               *float64
    TCPChallengeACK           *float64
    TCPSYNChallenge           *float64
    TCPFastOpenActive         *float64
    TCPFastOpenActiveFail     *float64
    TCPFastOpenPassive        *float64
    TCPFastOpenPassiveFail    *float64
    TCPFastOpenListenOverflow *float64
    TCPFastOpenCookieReqd     *float64
    TCPFastOpenBlackhole      *float64
    TCPSpuriousRtxHostQueues  *float64
    BusyPollRxPackets         *float64
    TCPAutoCorking            *float64
    TCPFromZeroWindowAdv      *float64
    TCPToZeroWindowAdv        *float64
    TCPWantZeroWindowAdv      *float64
    TCPSynRetrans             *float64
    TCPOrigDataSent           *float64
    TCPHystartTrainDetect     *float64
    TCPHystartTrainCwnd       *float64
    TCPHystartDelayDetect     *float64
    TCPHystartDelayCwnd       *float64
    TCPACKSkippedSynRecv      *float64
    TCPACKSkippedPAWS         *float64
    TCPACKSkippedSeq          *float64
    TCPACKSkippedFinWait2     *float64
    TCPACKSkippedTimeWait     *float64
    TCPACKSkippedChallenge    *float64
    TCPWinProbe               *float64
    TCPKeepAlive              *float64
    TCPMTUPFail               *float64
    TCPMTUPSuccess            *float64
    TCPWqueueTooBig           *float64
}

type Udp

type Udp struct {
    InDatagrams  *float64
    NoPorts      *float64
    InErrors     *float64
    OutDatagrams *float64
    RcvbufErrors *float64
    SndbufErrors *float64
    InCsumErrors *float64
    IgnoredMulti *float64
}

type Udp6

type Udp6 struct {
    InDatagrams  *float64
    NoPorts      *float64
    InErrors     *float64
    OutDatagrams *float64
    RcvbufErrors *float64
    SndbufErrors *float64
    InCsumErrors *float64
    IgnoredMulti *float64
}

type UdpLite

type UdpLite struct {
    InDatagrams  *float64
    NoPorts      *float64
    InErrors     *float64
    OutDatagrams *float64
    RcvbufErrors *float64
    SndbufErrors *float64
    InCsumErrors *float64
    IgnoredMulti *float64
}

type UdpLite6

type UdpLite6 struct {
    InDatagrams  *float64
    NoPorts      *float64
    InErrors     *float64
    OutDatagrams *float64
    RcvbufErrors *float64
    SndbufErrors *float64
    InCsumErrors *float64
}

type VM

The VM interface is described at

https://www.kernel.org/doc/Documentation/sysctl/vm.txt

Each setting is exposed as a single file. Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array and numa_zonelist_order (deprecated) which is a string.

type VM struct {
    AdminReserveKbytes        *int64   // /proc/sys/vm/admin_reserve_kbytes
    BlockDump                 *int64   // /proc/sys/vm/block_dump
    CompactUnevictableAllowed *int64   // /proc/sys/vm/compact_unevictable_allowed
    DirtyBackgroundBytes      *int64   // /proc/sys/vm/dirty_background_bytes
    DirtyBackgroundRatio      *int64   // /proc/sys/vm/dirty_background_ratio
    DirtyBytes                *int64   // /proc/sys/vm/dirty_bytes
    DirtyExpireCentisecs      *int64   // /proc/sys/vm/dirty_expire_centisecs
    DirtyRatio                *int64   // /proc/sys/vm/dirty_ratio
    DirtytimeExpireSeconds    *int64   // /proc/sys/vm/dirtytime_expire_seconds
    DirtyWritebackCentisecs   *int64   // /proc/sys/vm/dirty_writeback_centisecs
    DropCaches                *int64   // /proc/sys/vm/drop_caches
    ExtfragThreshold          *int64   // /proc/sys/vm/extfrag_threshold
    HugetlbShmGroup           *int64   // /proc/sys/vm/hugetlb_shm_group
    LaptopMode                *int64   // /proc/sys/vm/laptop_mode
    LegacyVaLayout            *int64   // /proc/sys/vm/legacy_va_layout
    LowmemReserveRatio        []*int64 // /proc/sys/vm/lowmem_reserve_ratio
    MaxMapCount               *int64   // /proc/sys/vm/max_map_count
    MemoryFailureEarlyKill    *int64   // /proc/sys/vm/memory_failure_early_kill
    MemoryFailureRecovery     *int64   // /proc/sys/vm/memory_failure_recovery
    MinFreeKbytes             *int64   // /proc/sys/vm/min_free_kbytes
    MinSlabRatio              *int64   // /proc/sys/vm/min_slab_ratio
    MinUnmappedRatio          *int64   // /proc/sys/vm/min_unmapped_ratio
    MmapMinAddr               *int64   // /proc/sys/vm/mmap_min_addr
    NrHugepages               *int64   // /proc/sys/vm/nr_hugepages
    NrHugepagesMempolicy      *int64   // /proc/sys/vm/nr_hugepages_mempolicy
    NrOvercommitHugepages     *int64   // /proc/sys/vm/nr_overcommit_hugepages
    NumaStat                  *int64   // /proc/sys/vm/numa_stat
    NumaZonelistOrder         string   // /proc/sys/vm/numa_zonelist_order
    OomDumpTasks              *int64   // /proc/sys/vm/oom_dump_tasks
    OomKillAllocatingTask     *int64   // /proc/sys/vm/oom_kill_allocating_task
    OvercommitKbytes          *int64   // /proc/sys/vm/overcommit_kbytes
    OvercommitMemory          *int64   // /proc/sys/vm/overcommit_memory
    OvercommitRatio           *int64   // /proc/sys/vm/overcommit_ratio
    PageCluster               *int64   // /proc/sys/vm/page-cluster
    PanicOnOom                *int64   // /proc/sys/vm/panic_on_oom
    PercpuPagelistFraction    *int64   // /proc/sys/vm/percpu_pagelist_fraction
    StatInterval              *int64   // /proc/sys/vm/stat_interval
    Swappiness                *int64   // /proc/sys/vm/swappiness
    UserReserveKbytes         *int64   // /proc/sys/vm/user_reserve_kbytes
    VfsCachePressure          *int64   // /proc/sys/vm/vfs_cache_pressure
    WatermarkBoostFactor      *int64   // /proc/sys/vm/watermark_boost_factor
    WatermarkScaleFactor      *int64   // /proc/sys/vm/watermark_scale_factor
    ZoneReclaimMode           *int64   // /proc/sys/vm/zone_reclaim_mode
}

type Wireless

Wireless models the content of /proc/net/wireless.

type Wireless struct {
    Name string

    // Status is the current 4-digit hex value status of the interface.
    Status uint64

    // QualityLink is the link quality.
    QualityLink int

    // QualityLevel is the signal gain (dBm).
    QualityLevel int

    // QualityNoise is the signal noise baseline (dBm).
    QualityNoise int

    // DiscardedNwid is the number of discarded packets with wrong nwid/essid.
    DiscardedNwid int

    // DiscardedCrypt is the number of discarded packets with wrong code/decode (WEP).
    DiscardedCrypt int

    // DiscardedFrag is the number of discarded packets that can't perform MAC reassembly.
    DiscardedFrag int

    // DiscardedRetry is the number of discarded packets that reached max MAC retries.
    DiscardedRetry int

    // DiscardedMisc is the number of discarded packets for other reasons.
    DiscardedMisc int

    // MissedBeacon is the number of missed beacons/superframe.
    MissedBeacon int
}

type XfrmStat

XfrmStat models the contents of /proc/net/xfrm_stat.

type XfrmStat struct {
    // All errors which are not matched by other
    XfrmInError int
    // No buffer is left
    XfrmInBufferError int
    // Header Error
    XfrmInHdrError int
    // No state found
    // i.e. either inbound SPI, address, or IPSEC protocol at SA is wrong
    XfrmInNoStates int
    // Transformation protocol specific error
    // e.g. SA Key is wrong
    XfrmInStateProtoError int
    // Transformation mode specific error
    XfrmInStateModeError int
    // Sequence error
    // e.g. sequence number is out of window
    XfrmInStateSeqError int
    // State is expired
    XfrmInStateExpired int
    // State has mismatch option
    // e.g. UDP encapsulation type is mismatched
    XfrmInStateMismatch int
    // State is invalid
    XfrmInStateInvalid int
    // No matching template for states
    // e.g. Inbound SAs are correct but SP rule is wrong
    XfrmInTmplMismatch int
    // No policy is found for states
    // e.g. Inbound SAs are correct but no SP is found
    XfrmInNoPols int
    // Policy discards
    XfrmInPolBlock int
    // Policy error
    XfrmInPolError int
    // All errors which are not matched by others
    XfrmOutError int
    // Bundle generation error
    XfrmOutBundleGenError int
    // Bundle check error
    XfrmOutBundleCheckError int
    // No state was found
    XfrmOutNoStates int
    // Transformation protocol specific error
    XfrmOutStateProtoError int
    // Transportation mode specific error
    XfrmOutStateModeError int
    // Sequence error
    // i.e sequence number overflow
    XfrmOutStateSeqError int
    // State is expired
    XfrmOutStateExpired int
    // Policy discads
    XfrmOutPolBlock int
    // Policy is dead
    XfrmOutPolDead int
    // Policy Error
    XfrmOutPolError int
    // Forward routing of a packet is not allowed
    XfrmFwdHdrError int
    // State is invalid, perhaps expired
    XfrmOutStateInvalid int
    // State hasn’t been fully acquired before use
    XfrmAcquireError int
}

func NewXfrmStat

func NewXfrmStat() (XfrmStat, error)

NewXfrmStat reads the xfrm_stat statistics.

type Zoneinfo

Zoneinfo holds info parsed from /proc/zoneinfo.

type Zoneinfo struct {
    Node                       string
    Zone                       string
    NrFreePages                *int64
    Min                        *int64
    Low                        *int64
    High                       *int64
    Scanned                    *int64
    Spanned                    *int64
    Present                    *int64
    Managed                    *int64
    NrActiveAnon               *int64
    NrInactiveAnon             *int64
    NrIsolatedAnon             *int64
    NrAnonPages                *int64
    NrAnonTransparentHugepages *int64
    NrActiveFile               *int64
    NrInactiveFile             *int64
    NrIsolatedFile             *int64
    NrFilePages                *int64
    NrSlabReclaimable          *int64
    NrSlabUnreclaimable        *int64
    NrMlockStack               *int64
    NrKernelStack              *int64
    NrMapped                   *int64
    NrDirty                    *int64
    NrWriteback                *int64
    NrUnevictable              *int64
    NrShmem                    *int64
    NrDirtied                  *int64
    NrWritten                  *int64
    NumaHit                    *int64
    NumaMiss                   *int64
    NumaForeign                *int64
    NumaInterleave             *int64
    NumaLocal                  *int64
    NumaOther                  *int64
    Protection                 []*int64
}

Subdirectories

Name Synopsis
..
bcache Package bcache provides access to statistics exposed by the bcache (Linux block cache).
blockdevice
btrfs Package btrfs provides access to statistics exposed by Btrfs filesystems.
iscsi
nfs Package nfs implements parsing of /proc/net/rpc/nfsd.
sysfs Package sysfs provides functions to retrieve system and kernel metrics from the pseudo-filesystem sys.
xfs Package xfs provides access to statistics exposed by the XFS filesystem.