procfs package - github.com/prometheus/procfs - Go Packages
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())
}
- Constants
- Variables
- type ARPEntry
- type BuddyInfo
- type CPUInfo
- type CPUStat
- type Cgroup
- type CgroupSummary
- type ConntrackStatEntry
- type Crypto
- type FS
- 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) GetMounts() ([]*MountInfo, error)
- func (fs FS) GetProcMounts(pid int) ([]*MountInfo, error)
- func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error)
- func (fs FS) IPVSStats() (IPVSStats, error)
- func (fs FS) KernelHung() (KernelHung, 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) NFNetLinkQueue() ([]NFNetLinkQueue, error)
- func (fs FS) NetDev() (NetDev, error)
- func (fs FS) NetDevSNMP6() (NetDevSNMP6, 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)deprecated
- func (fs FS) NetTCP6() (NetTCP, error)deprecated
- func (fs FS) NetTCP6Summary() (*NetTCPSummary, error)deprecated
- func (fs FS) NetTCPSummary() (*NetTCPSummary, error)deprecated
- 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)deprecated
- func (fs FS) NewStat() (Stat, error)deprecated
- 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 KernelHung
- type KernelRandom
- type LoadAvg
- type MDStat
- type MDStatComponent
- type Meminfo
- type Mount
- type MountInfo
- type MountStats
- type MountStatsNFS
- type NFNetLinkQueue
- type NFSBytesStats
- type NFSEventsStats
- type NFSOperationStats
- type NFSTransportStats
- type Namespace
- type Namespaces
- type NetDev
- type NetDevLine
- type NetDevSNMP6
- 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
- type NetUNIXLine
- type NetUNIXState
- type NetUNIXType
- type PSILine
- type PSIStats
- type Proc
- 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) NetDevSNMP6() (NetDevSNMP6, error)
- func (p Proc) Netstat() (ProcNetstat, error)
- func (p Proc) NewLimits() (ProcLimits, error)deprecated
- func (p Proc) NewStat() (ProcStat, error)deprecated
- func (p Proc) NewStatm() (ProcStatm, error)deprecated
- 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 (p Proc) Statm() (ProcStatm, error)
- func (proc Proc) Thread(tid int) (Proc, error)
- func (p Proc) Wchan() (string, error)
- type ProcFDInfo
- type ProcFDInfos
- type ProcIO
- type ProcLimits
- type ProcMap
- type ProcMapPermissions
- type ProcNetstat
- type ProcSMapsRollup
- type ProcSchedstat
- type ProcSnmp
- type ProcSnmp6
- type ProcStat
- type ProcStatm
- type ProcStatus
- type Procs
- type Schedstat
- type SchedstatCPU
- type Slab
- type SlabInfo
- type SoftIRQStat
- type Softirqs
- type SoftnetStat
- type Stat
- func NewStat() (Stat, error)deprecated
- type Swap
- type TLSStat
- type Tcp
- type TcpExt
- type Udp
- type Udp6
- type UdpLite
- type UdpLite6
- type VM
- type Wireless
- type XfrmStat
- type Zoneinfo
const ( ATFComplete = 0x02 ATFPermanent = 0x04 ATFPublish = 0x08 ATFUseTrailers = 0x10 ATFNetmask = 0x20 ATFDontPublish = 0x40 )
Learned from include/uapi/linux/if_arp.h.
This section is empty.
ARPEntry contains a single row of the columnar data represented in /proc/net/arp.
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.
CPUInfo contains general information about a system CPU found in /proc/cpuinfo.
CPUStat shows how much time the cpu spend in various stages.
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. The 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
A ConntrackStatEntry represents one line from net/stat/nf_conntrack and contains netfilter conntrack statistics at one CPU core.
Crypto holds info parsed from /proc/crypto.
FS represents the pseudo-filesystem sys, which provides an interface to kernel data structures.
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.
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.
AllProcs returns a list of all currently available processes.
AllThreads returns a list of all currently available threads for PID.
BuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem.
func (fs FS) CgroupSummarys() ([]CgroupSummary, error)
CgroupSummarys returns information about current /proc/cgroups.
CmdLine returns the command line of the kernel.
func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error)
ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores.
GatherARPEntries retrieves all the ARP entries, parse the relevant columns, and then return a slice of ARPEntry's.
GetMounts retrieves mountinfo information from `/proc/self/mountinfo`.
GetProcMounts retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`.
func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error)
IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.
IPVSStats reads the IPVS statistics from the specified `proc` filesystem.
func (fs FS) KernelHung() (KernelHung, error)
KernelHung returns values from /proc/sys/kernel/hung_task_detect_count.
func (FS) KernelRandom ¶ added in v0.1.0
func (fs FS) KernelRandom() (KernelRandom, error)
KernelRandom returns values from /proc/sys/kernel/random.
func (fs FS) NFNetLinkQueue() ([]NFNetLinkQueue, error)
NFNetLinkQueue returns information about current state of netfilter queues.
NetDev returns kernel/system statistics read from /proc/net/dev.
func (fs FS) NetDevSNMP6() (NetDevSNMP6, error)
Returns kernel/system statistics read from interface files within the /proc/net/dev_snmp6/ directory.
func (fs FS) NetRoute() ([]NetRouteLine, error)
func (fs FS) NetSockstat() (*NetSockstat, error)
NetSockstat retrieves IPv4 socket statistics.
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 FS) NetSoftnetStat() ([]SoftnetStat, error)
NetSoftnetStat reads data from /proc/net/softnet_stat.
func (fs FS) NetTCP6Summary() (*NetTCPSummary, error)
NetTCP6Summary returns already computed statistics like the total queue lengths for TCP datagrams read from /proc/net/tcp6.
Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET6) instead.
func (fs FS) NetTCPSummary() (*NetTCPSummary, error)
NetTCPSummary returns already computed statistics like the total queue lengths for TCP datagrams read from /proc/net/tcp.
Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET) instead.
NetUDP returns the IPv4 kernel/networking statistics for UDP datagrams read from /proc/net/udp.
NetUDP6 returns the IPv6 kernel/networking statistics for UDP datagrams read from /proc/net/udp6.
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 FS) NetUDPSummary() (*NetUDPSummary, error)
NetUDPSummary returns already computed statistics like the total queue lengths for UDP datagrams read from /proc/net/udp.
NewProc returns a process for the given pid.
Deprecated: Use fs.Proc() instead.
NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem.
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".
Proc returns a process for the given pid.
Self returns a process for the current process.
Swaps returns a slice of all configured swap devices on the system.
Thread returns a process for a given PID, TID.
VM reads the VM statistics from the specified `proc` filesystem.
type Fscacheinfo struct {
IndexCookiesAllocated uint64
DataStorageCookiesAllocated uint64
SpecialCookiesAllocated uint64
ObjectsAllocated uint64
ObjectAllocationsFailure uint64
ObjectsAvailable uint64
ObjectsDead uint64
ObjectsWithoutCoherencyCheck uint64
ObjectsWithCoherencyCheck uint64
ObjectsNeedCoherencyCheckUpdate uint64
ObjectsDeclaredObsolete uint64
PagesMarkedAsBeingCached uint64
UncachePagesRequestSeen uint64
AcquireCookiesRequestSeen uint64
AcquireRequestsWithNullParent uint64
AcquireRequestsRejectedNoCacheAvailable uint64
AcquireRequestsSucceeded uint64
AcquireRequestsRejectedDueToError uint64
AcquireRequestsFailedDueToEnomem uint64
LookupsNumber uint64
LookupsNegative uint64
LookupsPositive uint64
ObjectsCreatedByLookup uint64
LookupsTimedOutAndRequed uint64
InvalidationsNumber uint64
InvalidationsRunning uint64
UpdateCookieRequestSeen uint64
UpdateRequestsWithNullParent uint64
UpdateRequestsRunning uint64
RelinquishCookiesRequestSeen uint64
RelinquishCookiesWithNullParent uint64
RelinquishRequestsWaitingCompleteCreation uint64
RelinquishRetries uint64
AttributeChangedRequestsSeen uint64
AttributeChangedRequestsQueued uint64
AttributeChangedRejectDueToEnobufs uint64
AttributeChangedFailedDueToEnomem uint64
AttributeChangedOps uint64
AllocationRequestsSeen uint64
AllocationOkRequests uint64
AllocationWaitingOnLookup uint64
AllocationsRejectedDueToEnobufs uint64
AllocationsAbortedDueToErestartsys uint64
AllocationOperationsSubmitted uint64
AllocationsWaitedForCPU uint64
AllocationsAbortedDueToObjectDeath uint64
RetrievalsReadRequests uint64
RetrievalsOk uint64
RetrievalsWaitingLookupCompletion uint64
RetrievalsReturnedEnodata uint64
RetrievalsRejectedDueToEnobufs uint64
RetrievalsAbortedDueToErestartsys uint64
RetrievalsFailedDueToEnomem uint64
RetrievalsRequests uint64
RetrievalsWaitingCPU uint64
RetrievalsAbortedDueToObjectDeath uint64
StoreWriteRequests uint64
StoreSuccessfulRequests uint64
StoreRequestsOnPendingStorage uint64
StoreRequestsRejectedDueToEnobufs uint64
StoreRequestsFailedDueToEnomem uint64
StoreRequestsSubmitted uint64
StoreRequestsRunning uint64
StorePagesWithRequestsProcessing uint64
StoreRequestsDeleted uint64
StoreRequestsOverStoreLimit uint64
ReleaseRequestsAgainstPagesWithNoPendingStorage uint64
ReleaseRequestsAgainstPagesStoredByTimeLockGranted uint64
ReleaseRequestsIgnoredDueToInProgressStore uint64
PageStoresCancelledByReleaseRequests uint64
VmscanWaiting uint64
OpsPending uint64
OpsRunning uint64
OpsEnqueued uint64
OpsCancelled uint64
OpsRejected uint64
OpsInitialised uint64
OpsDeferred uint64
OpsReleased uint64
OpsGarbageCollected uint64
CacheopAllocationsinProgress uint64
CacheopLookupObjectInProgress uint64
CacheopLookupCompleteInPorgress uint64
CacheopGrabObjectInProgress uint64
CacheopInvalidations uint64
CacheopUpdateObjectInProgress uint64
CacheopDropObjectInProgress uint64
CacheopPutObjectInProgress uint64
CacheopAttributeChangeInProgress uint64
CacheopSyncCacheInProgress uint64
CacheopReadOrAllocPageInProgress uint64
CacheopReadOrAllocPagesInProgress uint64
CacheopAllocatePageInProgress uint64
CacheopAllocatePagesInProgress uint64
CacheopWritePagesInProgress uint64
CacheopUncachePagesInProgress uint64
CacheopDissociatePagesInProgress uint64
CacheevLookupsAndCreationsRejectedLackSpace uint64
CacheevStaleObjectsDeleted uint64
CacheevRetiredWhenReliquished uint64
CacheevObjectsCulled uint64
}
Fscacheinfo represents fscache statistics.
IPVSBackendStatus holds current metrics of one virtual / real address pair.
IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.
InotifyInfo represents a single inotify line in the fdinfo file.
Interrupt represents a single interrupt line.
type KernelHung struct {
HungTaskDetectCount *uint64
}
KernelHung contains information about to the kernel's hung_task_detect_count number.
type KernelRandom ¶ added in v0.1.0
type KernelRandom struct {
EntropyAvaliable *uint64
PoolSize *uint64
URandomMinReseedSeconds *uint64
WriteWakeupThreshold *uint64
ReadWakeupThreshold *uint64
}
KernelRandom contains information about to the kernel's random number generator.
LoadAvg represents an entry in /proc/loadavg.
MDStat holds info parsed from /proc/mdstat.
Meminfo represents memory statistics.
A Mount is a device mount parsed from /proc/[pid]/mountstats.
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
GetMounts retrieves mountinfo information from `/proc/self/mountinfo`.
GetProcMounts retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`.
type MountStats interface {
}
A MountStats is a type which contains detailed statistics for a specific type of Mount.
A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts.
NFNetLinkQueue contains general information about netfilter queues found in /proc/net/netfilter/nfnetlink_queue.
A NFSBytesStats contains statistics about the number of bytes read and written by an NFS client to and from an NFS server.
A NFSEventsStats contains statistics about NFS event occurrences.
A NFSOperationStats contains statistics for a single operation.
A NFSTransportStats contains statistics for the NFS mount RPC requests and responses.
Namespace represents a single namespace of a process.
Namespaces contains all of the namespaces that the process is contained in.
NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys are interface names.
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 struct {
Name string `json:"name"`
RxBytes uint64 `json:"rx_bytes"`
RxPackets uint64 `json:"rx_packets"`
RxErrors uint64 `json:"rx_errors"`
RxDropped uint64 `json:"rx_dropped"`
RxFIFO uint64 `json:"rx_fifo"`
RxFrame uint64 `json:"rx_frame"`
RxCompressed uint64 `json:"rx_compressed"`
RxMulticast uint64 `json:"rx_multicast"`
TxBytes uint64 `json:"tx_bytes"`
TxPackets uint64 `json:"tx_packets"`
TxErrors uint64 `json:"tx_errors"`
TxDropped uint64 `json:"tx_dropped"`
TxFIFO uint64 `json:"tx_fifo"`
TxCollisions uint64 `json:"tx_collisions"`
TxCarrier uint64 `json:"tx_carrier"`
TxCompressed uint64 `json:"tx_compressed"`
}
NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.
NetDevSNMP6 is parsed from files in /proc/net/dev_snmp6/ or /proc/<PID>/net/dev_snmp6/. The outer map's keys are interface names and the inner map's keys are stat names.
If you'd like a total across all interfaces, please use the Snmp6() method of the Proc type.
type NetIPSocket []*netIPSocketLine
NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header.
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.
NetProtocolCapabilities contains a list of capabilities for each protocol.
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.
NetProtocolStats stores the contents from /proc/net/protocols.
A NetRouteLine represents one line from net/route.
type NetSockstat struct {
Used *int
Protocols []NetSockstatProtocol
}
A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6, respectively.
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.
NetStat contains statistics for all the counters from one file.
type NetTCP []*netIPSocketLine
NetTCP represents the contents of /proc/net/tcp{,6} file without the header.
type NetTCPSummary NetIPSocketSummary
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 NetUDP []*netIPSocketLine
NetUDP represents the contents of /proc/net/udp{,6} file without the header.
type NetUDPSummary NetIPSocketSummary
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 NetUNIX struct {
Rows []*NetUNIXLine
}
NetUNIX holds the data read from /proc/net/unix.
NetUNIXFlags is the type of the flags field.
NetUNIXLine represents a line of /proc/net/unix.
NetUNIXState is the type of the state field.
NetUNIXType is the type of the type field.
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.
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 Proc struct {
PID int
}
Proc provides information about a running process.
NewProc returns a process for the given pid under /proc.
Self returns a process for the current process read via /proc/self.
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.
CmdLine returns the command line of a process.
Comm returns the command name of a process.
Cwd returns the absolute path to the current working directory of the process.
Environ reads process environments from `/proc/<pid>/environ`.
Executable returns the absolute path of the executable command of a process.
FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty.
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.
FileDescriptors returns the currently open file descriptors of a process.
func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error)
FileDescriptorsInfo retrieves information about all file descriptors of the process.
FileDescriptorsLen returns the number of currently open file descriptors of a process.
IO creates a new ProcIO instance from a given Proc instance.
func (p Proc) Interrupts() (Interrupts, error)
Interrupts creates a new instance from a given Proc instance.
Limits returns the current soft limits of the process.
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.
MountStats retrieves statistics and configuration for mount points in a process's namespace.
func (p Proc) Namespaces() (Namespaces, error)
Namespaces reads from /proc/<pid>/ns/* to get the namespaces of which the process is a member.
NetDev returns kernel/system statistics read from /proc/[pid]/net/dev.
func (p Proc) NetDevSNMP6() (NetDevSNMP6, error)
Returns kernel/system statistics read from interface files within the /proc/<PID>/net/dev_snmp6/ directory.
NewLimits returns the current soft limits of the process.
Deprecated: Use p.Limits() instead.
NewStat returns the current status information of the process.
Deprecated: Use p.Stat() instead.
NewStatm returns the current status information of the process.
Deprecated: Use p.Statm() instead.
NewStatus returns the current status information of the process.
ProcMaps reads from /proc/[pid]/maps to get the memory-mappings of the process.
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.
RootDir returns the absolute path to the process's root directory (as set by chroot).
Schedstat returns task scheduling information for the process.
Stat returns the current status information of the process.
Statm returns the current memory usage information of the process.
Thread returns a process for a given TID of Proc.
Wchan returns the wchan (wait channel) of a process.
ProcFDInfo contains represents file descriptor information.
type ProcFDInfos []ProcFDInfo
ProcFDInfos represents a list of ProcFDInfo structs.
InotifyWatchLen returns the total number of inotify watches.
func (p ProcFDInfos) Swap(i, j int)
ProcIO models the content of /proc/<pid>/io.
ProcMap contains the process memory-mappings of the process read from `/proc/[pid]/maps`.
ProcMapPermissions contains permission settings read from `/proc/[pid]/maps`.
ProcNetstat models the content of /proc/<pid>/net/netstat.
type ProcSchedstat struct {
RunningNanoseconds uint64
WaitingNanoseconds uint64
RunTimeslices uint64
}
ProcSchedstat contains the values from `/proc/<pid>/schedstat`.
ProcSnmp models the content of /proc/<pid>/net/snmp.
ProcSnmp6 models the content of /proc/<pid>/net/snmp6.
ProcStat provides status information about the process, read from /proc/[pid]/stat.
CPUTime returns the total CPU user and system time in seconds.
StartTime returns the unix timestamp of the process in seconds.
ProcStatm Provides memory usage information for a process, measured in memory pages. Read from /proc/[pid]/statm.
DataBytes returns the process of data + stack size in bytes.
ResidentBytes returns the process of resident set size in bytes.
SHRBytes returns the process of share memory size in bytes.
SizeBytes returns the process of total program size in bytes.
TextBytes returns the process of text (code) size in bytes.
ProcStatus provides status information about the process, read from /proc/[pid]/status.
func (s ProcStatus) TotalCtxtSwitches() uint64
TotalCtxtSwitches returns the total context switch.
Procs represents a list of Proc structs.
AllProcs returns a list of all currently available processes under /proc.
AllThreads returns a list of all currently available threads under /proc/PID.
SchedstatCPU contains the values from one "cpu<N>" line.
Slab represents a slab pool in the kernel.
type SlabInfo struct {
Slabs []*Slab
}
SlabInfo represents info for all slabs.
Softirqs represents the softirq statistics.
SoftnetStat contains a single row of data from /proc/net/softnet_stat.
Stat represents kernel/system statistics.
Swap represents an entry in /proc/swaps.
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 Wireless struct {
Name string
Status uint64
QualityLink int
QualityLevel int
QualityNoise int
DiscardedNwid int
DiscardedCrypt int
DiscardedFrag int
DiscardedRetry int
DiscardedMisc int
MissedBeacon int
}
Wireless models the content of /proc/net/wireless.
type XfrmStat struct {
XfrmInError int
XfrmInBufferError int
XfrmInHdrError int
XfrmInNoStates int
XfrmInStateProtoError int
XfrmInStateModeError int
XfrmInStateSeqError int
XfrmInStateExpired int
XfrmInStateMismatch int
XfrmInStateInvalid int
XfrmInTmplMismatch int
XfrmInNoPols int
XfrmInPolBlock int
XfrmInPolError int
XfrmOutError int
XfrmOutBundleGenError int
XfrmOutBundleCheckError int
XfrmOutNoStates int
XfrmOutStateProtoError int
XfrmOutStateModeError int
XfrmOutStateSeqError int
XfrmOutStateExpired int
XfrmOutPolBlock int
XfrmOutPolDead int
XfrmOutPolError int
XfrmFwdHdrError int
XfrmOutStateInvalid int
XfrmAcquireError int
}
XfrmStat models the contents of /proc/net/xfrm_stat.
NewXfrmStat reads the xfrm_stat statistics.
Zoneinfo holds info parsed from /proc/zoneinfo.