sysfs - ActiveState ActiveGo 1.8

Package sysfs

import ""

Overview ▾

Package sysfs provides functions to retrieve system and kernel metrics from the pseudo-filesystem sys.


DefaultMountPoint is the common mount point of the sys filesystem.

const DefaultMountPoint = "/sys"

type FS

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

type FS string

func NewFS

func NewFS(mountPoint string) (FS, error)

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

func (FS) BcacheStats

func (fs FS) BcacheStats() ([]*bcache.Stats, error)

BcacheStats retrieves bcache runtime statistics for each bcache.

func (FS) Path

func (fs FS) Path(p ...string) string

Path returns the path of the given subsystem relative to the sys root.

func (FS) XFSStats

func (fs FS) XFSStats() ([]*xfs.Stats, error)

XFSStats retrieves XFS filesystem runtime statistics for each mounted XFS filesystem. Only available on kernel 4.4+. On older kernels, an empty slice of *xfs.Stats will be returned.