Documentation ¶
Overview ¶
Package sysfs provides functions to retrieve system and kernel metrics from the pseudo-filesystem sys.
Index ¶
Constants ¶
const DefaultMountPoint = "/sys"
DefaultMountPoint is the common mount point of the sys filesystem.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS string
FS represents the pseudo-filesystem sys, which provides an interface to kernel data structures.
func NewFS ¶
NewFS returns a new FS mounted under the given mountPoint. It will error if the mount point can't be read.
func (FS) BcacheStats ¶
BcacheStats retrieves bcache runtime statistics for each bcache.
func (FS) NewNetClass ¶
NewNetClass returns info for all net interfaces (iface) read from /sys/class/net/<iface>.
func (FS) NewSystemCpufreq ¶
func (fs FS) NewSystemCpufreq() ([]SystemCPUCpufreqStats, error)
NewSystemCpufreq returns CPU frequency metrics for all CPUs.
func (FS) Path ¶
Path returns the path of the given subsystem relative to the sys root.
type NetClass ¶
type NetClass map[string]NetClassIface
NetClass is collection of info for every interface (iface) in /sys/class/net. The map keys are interface (iface) names.
type NetClassIface ¶
type NetClassIface struct { Name string // Interface name AddrAssignType *int64 `fileName:"addr_assign_type"` // /sys/class/net/<iface>/addr_assign_type AddrLen *int64 `fileName:"addr_len"` // /sys/class/net/<iface>/addr_len Address string `fileName:"address"` // /sys/class/net/<iface>/address Broadcast string `fileName:"broadcast"` // /sys/class/net/<iface>/broadcast Carrier *int64 `fileName:"carrier"` // /sys/class/net/<iface>/carrier CarrierChanges *int64 `fileName:"carrier_changes"` // /sys/class/net/<iface>/carrier_changes CarrierUpCount *int64 `fileName:"carrier_up_count"` // /sys/class/net/<iface>/carrier_up_count CarrierDownCount *int64 `fileName:"carrier_down_count"` // /sys/class/net/<iface>/carrier_down_count DevID *int64 `fileName:"dev_id"` // /sys/class/net/<iface>/dev_id Dormant *int64 `fileName:"dormant"` // /sys/class/net/<iface>/dormant Duplex string `fileName:"duplex"` // /sys/class/net/<iface>/duplex Flags *int64 `fileName:"flags"` // /sys/class/net/<iface>/flags IfAlias string `fileName:"ifalias"` // /sys/class/net/<iface>/ifalias IfIndex *int64 `fileName:"ifindex"` // /sys/class/net/<iface>/ifindex IfLink *int64 `fileName:"iflink"` // /sys/class/net/<iface>/iflink LinkMode *int64 `fileName:"link_mode"` // /sys/class/net/<iface>/link_mode MTU *int64 `fileName:"mtu"` // /sys/class/net/<iface>/mtu NameAssignType *int64 `fileName:"name_assign_type"` // /sys/class/net/<iface>/name_assign_type NetDevGroup *int64 `fileName:"netdev_group"` // /sys/class/net/<iface>/netdev_group OperState string `fileName:"operstate"` // /sys/class/net/<iface>/operstate PhysPortID string `fileName:"phys_port_id"` // /sys/class/net/<iface>/phys_port_id PhysPortName string `fileName:"phys_port_name"` // /sys/class/net/<iface>/phys_port_name PhysSwitchID string `fileName:"phys_switch_id"` // /sys/class/net/<iface>/phys_switch_id Speed *int64 `fileName:"speed"` // /sys/class/net/<iface>/speed TxQueueLen *int64 `fileName:"tx_queue_len"` // /sys/class/net/<iface>/tx_queue_len Type *int64 `fileName:"type"` // /sys/class/net/<iface>/type }
NetClassIface contains info from files in /sys/class/net/<iface> for single interface (iface).
type SystemCPUCpufreqStats ¶
type SystemCPUCpufreqStats struct { Name string CurrentFrequency uint64 MinimumFrequency uint64 MaximumFrequency uint64 TransitionLatency uint64 AvailableGovernors string Driver string Govenor string RelatedCpus string SetSpeed string }
SystemCPUCpufreqStats contains stats from devices/system/cpu/cpu[0-9]*/cpufreq/...
func NewSystemCpufreq ¶
func NewSystemCpufreq() ([]SystemCPUCpufreqStats, error)
NewSystemCpufreq returns CPU frequency metrics for all CPUs.