Documentation ¶
Overview ¶
Package sysfs provides functions to retrieve system and kernel metrics from the pseudo-filesystem sys.
Index ¶
- Constants
- Variables
- func ParseNetClassAttribute(devicePath, attrName string, interfaceClass *NetClassIface) error
- type CPU
- type CPUThermalThrottle
- type CPUTopology
- type ClassCoolingDeviceStats
- type ClassDRMCardAMDGPUStats
- type ClassThermalZoneStats
- type ClockSource
- type DMIClass
- type FS
- func (fs FS) CPUVulnerabilities() (map[string]*Vulnerability, error)
- func (fs FS) CPUs() ([]CPU, error)
- func (fs FS) ClassCoolingDeviceStats() ([]ClassCoolingDeviceStats, error)
- func (fs FS) ClassDRMCardAMDGPUStats() ([]ClassDRMCardAMDGPUStats, error)
- func (fs FS) ClassThermalZoneStats() ([]ClassThermalZoneStats, error)
- func (fs FS) ClockSources() ([]ClockSource, error)
- func (fs FS) DMIClass() (*DMIClass, error)
- func (fs FS) FibreChannelClass() (FibreChannelClass, error)
- func (fs FS) InfiniBandClass() (InfiniBandClass, error)
- func (fs FS) IsolatedCPUs() ([]uint16, error)
- func (fs FS) Mdraids() ([]Mdraid, error)
- func (fs FS) NVMeClass() (NVMeClass, error)
- func (fs FS) NetClass() (NetClass, error)
- func (fs FS) NetClassByIface(devicePath string) (*NetClassIface, error)
- func (fs FS) NetClassDevices() ([]string, error)
- func (fs FS) PowerSupplyClass() (PowerSupplyClass, error)
- func (fs FS) SASDeviceClass() (SASDeviceClass, error)
- func (fs FS) SASEndDeviceClass() (SASDeviceClass, error)
- func (fs FS) SASExpanderClass() (SASDeviceClass, error)
- func (fs FS) SASHostClass() (SASHostClass, error)
- func (fs FS) SASPhyClass() (SASPhyClass, error)
- func (fs FS) SASPortClass() (SASPortClass, error)
- func (fs FS) SCSITapeClass() (SCSITapeClass, error)
- func (fs FS) SystemCpufreq() ([]SystemCPUCpufreqStats, error)
- func (fs FS) VMStatNUMA() (map[int]VMStat, error)
- type FibreChannelClass
- type FibreChannelCounters
- type FibreChannelHost
- type InfiniBandClass
- type InfiniBandCounters
- type InfiniBandDevice
- type InfiniBandHwCounters
- type InfiniBandPort
- type Mdraid
- type MdraidComponent
- type NVMeClass
- type NVMeDevice
- type NetClass
- type NetClassIface
- type PowerSupply
- type PowerSupplyClass
- type RaplZone
- type SASDevice
- type SASDeviceClass
- type SASHost
- type SASHostClass
- type SASPhy
- type SASPhyClass
- type SASPort
- type SASPortClass
- type SCSITape
- type SCSITapeClass
- type SCSITapeCounters
- type SystemCPUCpufreqStats
- type VMStat
- type Vulnerability
Constants ¶
const ( VulnerabilityStateNotAffected = iota VulnerabilityStateVulnerable VulnerabilityStateMitigation VulnerabilityStateUnknown )
const DefaultMountPoint = fs.DefaultSysMountPoint
DefaultMountPoint is the common mount point of the sys filesystem.
Variables ¶
var ( // VulnerabilityHumanEncoding allows mapping the vulnerability state (encoded as an int) onto a human friendly // string. It can be used by consumers of this library to expose to the user the state of the vulnerability. VulnerabilityHumanEncoding = map[int]string{ VulnerabilityStateNotAffected: notAffected, VulnerabilityStateVulnerable: vulnerable, VulnerabilityStateMitigation: mitigation, VulnerabilityStateUnknown: unknown, } )
Functions ¶
func ParseNetClassAttribute ¶
func ParseNetClassAttribute(devicePath, attrName string, interfaceClass *NetClassIface) error
ParseNetClassAttribute parses a given file in /sys/class/net/<iface> and sets the value in a given NetClassIface object if the value was readable. It returns an error if the file cannot be read and the error is fatal.
Types ¶
type CPU ¶
type CPU string
CPU represents a path to a CPU located in `/sys/devices/system/cpu/cpu[0-9]*`.
func (CPU) ThermalThrottle ¶
func (c CPU) ThermalThrottle() (*CPUThermalThrottle, error)
ThermalThrottle gets the cpu throttle count information for a single CPU from `/sys/devices/system/cpu/cpuN/thermal_throttle`.
func (CPU) Topology ¶
func (c CPU) Topology() (*CPUTopology, error)
Topology gets the topology information for a single CPU from `/sys/devices/system/cpu/cpuN/topology`.
type CPUThermalThrottle ¶
CPUThermalThrottle contains data from `/sys/devices/system/cpu/cpu[0-9]*/thermal_throttle`.
type CPUTopology ¶
type CPUTopology struct { CoreID string CoreSiblingsList string PhysicalPackageID string ThreadSiblingsList string }
CPUTopology contains data located in `/sys/devices/system/cpu/cpu[0-9]*/topology`.
type ClassCoolingDeviceStats ¶
type ClassCoolingDeviceStats struct { Name string // The name of the cooling device. Type string // Type of the cooling device(processor/fan/...) MaxState int64 // Maximum cooling state of the cooling device CurState int64 // Current cooling state of the cooling device }
ClassCoolingDeviceStats contains info from files in /sys/class/thermal/cooling_device[0-9]* for a single device. https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt
type ClassDRMCardAMDGPUStats ¶
type ClassDRMCardAMDGPUStats struct { Name string // The card name. GPUBusyPercent uint64 // How busy the GPU is as a percentage. MemoryGTTSize uint64 // The size of the graphics translation table (GTT) block in bytes. MemoryGTTUsed uint64 // The used amount of the graphics translation table (GTT) block in bytes. MemoryVisibleVRAMSize uint64 // The size of visible VRAM in bytes. MemoryVisibleVRAMUsed uint64 // The used amount of visible VRAM in bytes. MemoryVRAMSize uint64 // The size of VRAM in bytes. MemoryVRAMUsed uint64 // The used amount of VRAM in bytes. MemoryVRAMVendor string // The VRAM vendor name. PowerDPMForcePerformanceLevel string // The current power performance level. UniqueID string // The unique ID of the GPU that will persist from machine to machine. }
ClassDRMCardAMDGPUStats contains info from files in /sys/class/drm/card<card>/device for a single amdgpu card. Not all cards expose all metrics. https://www.kernel.org/doc/html/latest/gpu/amdgpu.html
type ClassThermalZoneStats ¶
type ClassThermalZoneStats struct { Name string // The name of the zone from the directory structure. Type string // The type of thermal zone. Temp int64 // Temperature in millidegree Celsius. Policy string // One of the various thermal governors used for a particular zone. Mode *bool // Optional: One of the predefined values in [enabled, disabled]. Passive *uint64 // Optional: millidegrees Celsius. (0 for disabled, > 1000 for enabled+value) }
ClassThermalZoneStats contains info from files in /sys/class/thermal/thermal_zone<zone> for a single <zone>. https://www.kernel.org/doc/Documentation/thermal/sysfs-api.txt
type ClockSource ¶
ClockSource contains metrics related to the clock source.
type DMIClass ¶
type DMIClass struct { BiosDate *string // /sys/class/dmi/id/bios_date BiosRelease *string // /sys/class/dmi/id/bios_release BiosVendor *string // /sys/class/dmi/id/bios_vendor BiosVersion *string // /sys/class/dmi/id/bios_version BoardAssetTag *string // /sys/class/dmi/id/board_asset_tag BoardName *string // /sys/class/dmi/id/board_name BoardSerial *string // /sys/class/dmi/id/board_serial BoardVendor *string // /sys/class/dmi/id/board_vendor BoardVersion *string // /sys/class/dmi/id/board_version ChassisAssetTag *string // /sys/class/dmi/id/chassis_asset_tag ChassisSerial *string // /sys/class/dmi/id/chassis_serial ChassisType *string // /sys/class/dmi/id/chassis_type ChassisVendor *string // /sys/class/dmi/id/chassis_vendor ChassisVersion *string // /sys/class/dmi/id/chassis_version ProductFamily *string // /sys/class/dmi/id/product_family ProductName *string // /sys/class/dmi/id/product_name ProductSerial *string // /sys/class/dmi/id/product_serial ProductSKU *string // /sys/class/dmi/id/product_sku ProductUUID *string // /sys/class/dmi/id/product_uuid ProductVersion *string // /sys/class/dmi/id/product_version SystemVendor *string // /sys/class/dmi/id/sys_vendor }
DMIClass contains info from files in /sys/class/dmi/id.
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS represents the pseudo-filesystem sys, which provides an interface to kernel data structures.
func NewDefaultFS ¶
NewDefaultFS returns a new FS mounted under the default mountPoint. It will error if the mount point can't be read.
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) CPUVulnerabilities ¶
func (fs FS) CPUVulnerabilities() (map[string]*Vulnerability, error)
CPUVulnerabilities retrieves a map of vulnerability names to their mitigations.
func (FS) ClassCoolingDeviceStats ¶
func (fs FS) ClassCoolingDeviceStats() ([]ClassCoolingDeviceStats, error)
func (FS) ClassDRMCardAMDGPUStats ¶
func (fs FS) ClassDRMCardAMDGPUStats() ([]ClassDRMCardAMDGPUStats, error)
ClassDRMCardAMDGPUStats returns DRM card metrics for all amdgpu cards.
func (FS) ClassThermalZoneStats ¶
func (fs FS) ClassThermalZoneStats() ([]ClassThermalZoneStats, error)
ClassThermalZoneStats returns Thermal Zone metrics for all zones.
func (FS) ClockSources ¶
func (fs FS) ClockSources() ([]ClockSource, error)
ClockSources returns clocksource information including current and available clocksources read from '/sys/devices/system/clocksource'.
func (FS) DMIClass ¶
DMIClass returns Desktop Management Interface (DMI) information read from /sys/class/dmi.
func (FS) FibreChannelClass ¶
func (fs FS) FibreChannelClass() (FibreChannelClass, error)
FibreChannelClass parses everything in /sys/class/fc_host.
func (FS) InfiniBandClass ¶
func (fs FS) InfiniBandClass() (InfiniBandClass, error)
InfiniBandClass returns info for all InfiniBand devices read from /sys/class/infiniband.
func (FS) IsolatedCPUs ¶
func (FS) Mdraids ¶
Mdraids gathers information and statistics about mdraid devices present. Based on upstream kernel documentation https://docs.kernel.org/admin-guide/md.html.
func (FS) NetClass ¶
NetClass returns info for all net interfaces (iface) read from /sys/class/net/<iface>.
func (FS) NetClassByIface ¶
func (fs FS) NetClassByIface(devicePath string) (*NetClassIface, error)
NetClassByIface returns info for a single net interfaces (iface).
func (FS) NetClassDevices ¶
NetClassDevices scans /sys/class/net for devices and returns them as a list of names.
func (FS) PowerSupplyClass ¶
func (fs FS) PowerSupplyClass() (PowerSupplyClass, error)
PowerSupplyClass returns info for all power supplies read from /sys/class/power_supply.
func (FS) SASDeviceClass ¶
func (fs FS) SASDeviceClass() (SASDeviceClass, error)
SASDeviceClass parses devices in /sys/class/sas_device.
func (FS) SASEndDeviceClass ¶
func (fs FS) SASEndDeviceClass() (SASDeviceClass, error)
SASEndDeviceClass parses devices in /sys/class/sas_end_device. This is a subset of sas_device, and excludes expanders.
func (FS) SASExpanderClass ¶
func (fs FS) SASExpanderClass() (SASDeviceClass, error)
SASExpanderClass parses devices in /sys/class/sas_expander. This is a subset of sas_device, but only includes expanders.
func (FS) SASHostClass ¶
func (fs FS) SASHostClass() (SASHostClass, error)
SASHostClass parses host[0-9]+ devices in /sys/class/sas_host. This generally only exists so that it can pull in SAS Port and SAS PHY entries.
The sas_host class doesn't collect any obvious statistics. Each sas_host contains a scsi_host, which seems to collect a couple minor stats (ioc_reset_count and reply_queue_count), but they're not worth collecting at this time. There are more useful SAS stats in the sas_phy class.
func (FS) SASPhyClass ¶
func (fs FS) SASPhyClass() (SASPhyClass, error)
SASPhyClass parses entries in /sys/class/sas_phy.
func (FS) SASPortClass ¶
func (fs FS) SASPortClass() (SASPortClass, error)
SASPortClass parses ports in /sys/class/sas_port.
A SAS port in this context is a collection of SAS PHYs operating together. For example, it's common to have 8-lane SAS cards that have 2 external connectors, each of which carries 4 SAS lanes over a SFF-8088 or SFF-8644 connector. While it's possible to split those 4 lanes into 4 different cables wired directly into individual drives, it's more common to connect them all to a SAS expander. This gives you 4x the bandwidth between the expander and the SAS host, and is represented by a sas-port object which contains 4 sas-phy objects.
func (FS) SCSITapeClass ¶
func (fs FS) SCSITapeClass() (SCSITapeClass, error)
SCSITapeClass parses st[0-9]+ devices in /sys/class/scsi_tape.
func (FS) SystemCpufreq ¶
func (fs FS) SystemCpufreq() ([]SystemCPUCpufreqStats, error)
SystemCpufreq returns CPU frequency metrics for all CPUs.
type FibreChannelClass ¶
type FibreChannelClass map[string]FibreChannelHost
type FibreChannelCounters ¶
type FibreChannelCounters struct { DumpedFrames uint64 // /sys/class/fc_host/<Name>/statistics/dumped_frames ErrorFrames uint64 // /sys/class/fc_host/<Name>/statistics/error_frames InvalidCRCCount uint64 // /sys/class/fc_host/<Name>/statistics/invalid_crc_count RXFrames uint64 // /sys/class/fc_host/<Name>/statistics/rx_frames RXWords uint64 // /sys/class/fc_host/<Name>/statistics/rx_words TXFrames uint64 // /sys/class/fc_host/<Name>/statistics/tx_frames TXWords uint64 // /sys/class/fc_host/<Name>/statistics/tx_words SecondsSinceLastReset uint64 // /sys/class/fc_host/<Name>/statistics/seconds_since_last_reset InvalidTXWordCount uint64 // /sys/class/fc_host/<Name>/statistics/invalid_tx_word_count LinkFailureCount uint64 // /sys/class/fc_host/<Name>/statistics/link_failure_count LossOfSyncCount uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_sync_count LossOfSignalCount uint64 // /sys/class/fc_host/<Name>/statistics/loss_of_signal_count NosCount uint64 // /sys/class/fc_host/<Name>/statistics/nos_count FCPPacketAborts uint64 // / sys/class/fc_host/<Name>/statistics/fcp_packet_aborts }
type FibreChannelHost ¶
type FibreChannelHost struct { Name string // /sys/class/fc_host/<Name> Speed string // /sys/class/fc_host/<Name>/speed PortState string // /sys/class/fc_host/<Name>/port_state PortType string // /sys/class/fc_host/<Name>/port_type SymbolicName string // /sys/class/fc_host/<Name>/symbolic_name NodeName string // /sys/class/fc_host/<Name>/node_name PortID string // /sys/class/fc_host/<Name>/port_id PortName string // /sys/class/fc_host/<Name>/port_name FabricName string // /sys/class/fc_host/<Name>/fabric_name DevLossTMO string // /sys/class/fc_host/<Name>/dev_loss_tmo SupportedClasses string // /sys/class/fc_host/<Name>/supported_classes SupportedSpeeds string // /sys/class/fc_host/<Name>/supported_speeds Counters FibreChannelCounters // /sys/class/fc_host/<Name>/statistics/* }
type InfiniBandClass ¶
type InfiniBandClass map[string]InfiniBandDevice
InfiniBandClass is a collection of every InfiniBand device in /sys/class/infiniband.
The map keys are the names of the InfiniBand devices.
type InfiniBandCounters ¶
type InfiniBandCounters struct { LegacyPortMulticastRcvPackets *uint64 // counters_ext/port_multicast_rcv_packets LegacyPortMulticastXmitPackets *uint64 // counters_ext/port_multicast_xmit_packets LegacyPortRcvData64 *uint64 // counters_ext/port_rcv_data_64 LegacyPortRcvPackets64 *uint64 // counters_ext/port_rcv_packets_64 LegacyPortUnicastRcvPackets *uint64 // counters_ext/port_unicast_rcv_packets LegacyPortUnicastXmitPackets *uint64 // counters_ext/port_unicast_xmit_packets LegacyPortXmitData64 *uint64 // counters_ext/port_xmit_data_64 LegacyPortXmitPackets64 *uint64 // counters_ext/port_xmit_packets_64 ExcessiveBufferOverrunErrors *uint64 // counters/excessive_buffer_overrun_errors LinkDowned *uint64 // counters/link_downed LinkErrorRecovery *uint64 // counters/link_error_recovery LocalLinkIntegrityErrors *uint64 // counters/local_link_integrity_errors MulticastRcvPackets *uint64 // counters/multicast_rcv_packets MulticastXmitPackets *uint64 // counters/multicast_xmit_packets PortRcvConstraintErrors *uint64 // counters/port_rcv_constraint_errors PortRcvData *uint64 // counters/port_rcv_data PortRcvDiscards *uint64 // counters/port_rcv_discards PortRcvErrors *uint64 // counters/port_rcv_errors PortRcvPackets *uint64 // counters/port_rcv_packets PortRcvRemotePhysicalErrors *uint64 // counters/port_rcv_remote_physical_errors PortRcvSwitchRelayErrors *uint64 // counters/port_rcv_switch_relay_errors PortXmitConstraintErrors *uint64 // counters/port_xmit_constraint_errors PortXmitData *uint64 // counters/port_xmit_data PortXmitDiscards *uint64 // counters/port_xmit_discards PortXmitPackets *uint64 // counters/port_xmit_packets PortXmitWait *uint64 // counters/port_xmit_wait SymbolError *uint64 // counters/symbol_error UnicastRcvPackets *uint64 // counters/unicast_rcv_packets UnicastXmitPackets *uint64 // counters/unicast_xmit_packets VL15Dropped *uint64 // counters/VL15_dropped }
InfiniBandCounters contains counter values from files in /sys/class/infiniband/<Name>/ports/<Port>/counters or /sys/class/infiniband/<Name>/ports/<Port>/counters_ext for a single port of one InfiniBand device.
type InfiniBandDevice ¶
type InfiniBandDevice struct { Name string BoardID string // /sys/class/infiniband/<Name>/board_id FirmwareVersion string // /sys/class/infiniband/<Name>/fw_ver HCAType string // /sys/class/infiniband/<Name>/hca_type Ports map[uint]InfiniBandPort }
InfiniBandDevice contains info from files in /sys/class/infiniband for a single InfiniBand device.
type InfiniBandHwCounters ¶
type InfiniBandHwCounters struct { DuplicateRequest *uint64 // hw_counters/duplicate_request ImpliedNakSeqErr *uint64 // hw_counters/implied_nak_seq_err Lifespan *uint64 // hw_counters/lifespan LocalAckTimeoutErr *uint64 // hw_counters/local_ack_timeout_err NpCnpSent *uint64 // hw_counters/np_cnp_sent NpEcnMarkedRocePackets *uint64 // hw_counters/np_ecn_marked_roce_packets OutOfBuffer *uint64 // hw_counters/out_of_buffer OutOfSequence *uint64 // hw_counters/out_of_sequence PacketSeqErr *uint64 // hw_counters/packet_seq_err ReqCqeError *uint64 // hw_counters/req_cqe_error ReqCqeFlushError *uint64 // hw_counters/req_cqe_flush_error ReqRemoteAccessErrors *uint64 // hw_counters/req_remote_access_errors ReqRemoteInvalidRequest *uint64 // hw_counters/req_remote_invalid_request RespCqeError *uint64 // hw_counters/resp_cqe_error RespCqeFlushError *uint64 // hw_counters/resp_cqe_flush_error RespLocalLengthError *uint64 // hw_counters/resp_local_length_error RespRemoteAccessErrors *uint64 // hw_counters/resp_remote_access_errors RnrNakRetryErr *uint64 // hw_counters/rnr_nak_retry_err RoceAdpRetrans *uint64 // hw_counters/roce_adp_retrans RoceAdpRetransTo *uint64 // hw_counters/roce_adp_retrans_to RoceSlowRestart *uint64 // hw_counters/roce_slow_restart RoceSlowRestartCnps *uint64 // hw_counters/roce_slow_restart_cnps RoceSlowRestartTrans *uint64 // hw_counters/roce_slow_restart_trans RpCnpHandled *uint64 // hw_counters/rp_cnp_handled RpCnpIgnored *uint64 // hw_counters/rp_cnp_ignored RxAtomicRequests *uint64 // hw_counters/rx_atomic_requests RxDctConnect *uint64 // hw_counters/rx_dct_connect RxIcrcEncapsulated *uint64 // hw_counters/rx_icrc_encapsulated RxReadRequests *uint64 // hw_counters/rx_read_requests RxWriteRequests *uint64 // hw_counters/rx_write_requests }
InfiniBandHwCounters contains counter value from files in /sys/class/infiniband/<Name>/ports/<Port>/hw_counters for a single port of one InfiniBand device.
type InfiniBandPort ¶
type InfiniBandPort struct { Name string Port uint State string // String representation from /sys/class/infiniband/<Name>/ports/<Port>/state StateID uint // ID from /sys/class/infiniband/<Name>/ports/<Port>/state PhysState string // String representation from /sys/class/infiniband/<Name>/ports/<Port>/phys_state PhysStateID uint // String representation from /sys/class/infiniband/<Name>/ports/<Port>/phys_state Rate uint64 // in bytes/second from /sys/class/infiniband/<Name>/ports/<Port>/rate Counters InfiniBandCounters HwCounters InfiniBandHwCounters }
InfiniBandPort contains info from files in /sys/class/infiniband/<Name>/ports/<Port> for a single port of one InfiniBand device.
type Mdraid ¶
type Mdraid struct { Device string // Kernel device name of array. Level string // mdraid level. ArrayState string // State of the array. MetadataVersion string // mdraid metadata version. Disks uint64 // Number of devices in a fully functional array. Components []MdraidComponent // mdraid component devices. UUID string // UUID of the array. // The following item is only valid for raid0, 4, 5, 6 and 10. ChunkSize uint64 // Chunk size // The following items are only valid for raid1, 4, 5, 6 and 10. DegradedDisks uint64 // Number of degraded disks in the array. SyncAction string // Current sync action. SyncCompleted float64 // Fraction (0-1) representing the completion status of current sync operation. }
Mdraid holds info parsed from relevant files in the /sys/block/md*/md directory.
type MdraidComponent ¶
type NVMeClass ¶
type NVMeClass map[string]NVMeDevice
NVMeClass is a collection of every NVMe device in /sys/class/nvme.
The map keys are the names of the NVMe devices.
type NVMeDevice ¶
type NVMeDevice struct { Name string Serial string // /sys/class/nvme/<Name>/serial Model string // /sys/class/nvme/<Name>/model State string // /sys/class/nvme/<Name>/state FirmwareRevision string // /sys/class/nvme/<Name>/firmware_rev }
NVMeDevice contains info from files in /sys/class/nvme for a single NVMe device.
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 // /sys/class/net/<iface>/addr_assign_type AddrLen *int64 // /sys/class/net/<iface>/addr_len Address string // /sys/class/net/<iface>/address Broadcast string // /sys/class/net/<iface>/broadcast Carrier *int64 // /sys/class/net/<iface>/carrier CarrierChanges *int64 // /sys/class/net/<iface>/carrier_changes CarrierUpCount *int64 // /sys/class/net/<iface>/carrier_up_count CarrierDownCount *int64 // /sys/class/net/<iface>/carrier_down_count DevID *int64 // /sys/class/net/<iface>/dev_id Dormant *int64 // /sys/class/net/<iface>/dormant Duplex string // /sys/class/net/<iface>/duplex Flags *int64 // /sys/class/net/<iface>/flags IfAlias string // /sys/class/net/<iface>/ifalias IfIndex *int64 // /sys/class/net/<iface>/ifindex IfLink *int64 // /sys/class/net/<iface>/iflink LinkMode *int64 // /sys/class/net/<iface>/link_mode MTU *int64 // /sys/class/net/<iface>/mtu NameAssignType *int64 // /sys/class/net/<iface>/name_assign_type NetDevGroup *int64 // /sys/class/net/<iface>/netdev_group OperState string // /sys/class/net/<iface>/operstate PhysPortID string // /sys/class/net/<iface>/phys_port_id PhysPortName string // /sys/class/net/<iface>/phys_port_name PhysSwitchID string // /sys/class/net/<iface>/phys_switch_id Speed *int64 // /sys/class/net/<iface>/speed TxQueueLen *int64 // /sys/class/net/<iface>/tx_queue_len Type *int64 // /sys/class/net/<iface>/type }
NetClassIface contains info from files in /sys/class/net/<iface> for single interface (iface).
type PowerSupply ¶
type PowerSupply struct { Name string // Power Supply Name Authentic *int64 // /sys/class/power_supply/<Name>/authentic Calibrate *int64 // /sys/class/power_supply/<Name>/calibrate Capacity *int64 // /sys/class/power_supply/<Name>/capacity CapacityAlertMax *int64 // /sys/class/power_supply/<Name>/capacity_alert_max CapacityAlertMin *int64 // /sys/class/power_supply/<Name>/capacity_alert_min CapacityLevel string // /sys/class/power_supply/<Name>/capacity_level ChargeAvg *int64 // /sys/class/power_supply/<Name>/charge_avg ChargeControlLimit *int64 // /sys/class/power_supply/<Name>/charge_control_limit ChargeControlLimitMax *int64 // /sys/class/power_supply/<Name>/charge_control_limit_max ChargeCounter *int64 // /sys/class/power_supply/<Name>/charge_counter ChargeEmpty *int64 // /sys/class/power_supply/<Name>/charge_empty ChargeEmptyDesign *int64 // /sys/class/power_supply/<Name>/charge_empty_design ChargeFull *int64 // /sys/class/power_supply/<Name>/charge_full ChargeFullDesign *int64 // /sys/class/power_supply/<Name>/charge_full_design ChargeNow *int64 // /sys/class/power_supply/<Name>/charge_now ChargeTermCurrent *int64 // /sys/class/power_supply/<Name>/charge_term_current ChargeType string // /sys/class/power_supply/<Name>/charge_type ConstantChargeCurrent *int64 // /sys/class/power_supply/<Name>/constant_charge_current ConstantChargeCurrentMax *int64 // /sys/class/power_supply/<Name>/constant_charge_current_max ConstantChargeVoltage *int64 // /sys/class/power_supply/<Name>/constant_charge_voltage ConstantChargeVoltageMax *int64 // /sys/class/power_supply/<Name>/constant_charge_voltage_max CurrentAvg *int64 // /sys/class/power_supply/<Name>/current_avg CurrentBoot *int64 // /sys/class/power_supply/<Name>/current_boot CurrentMax *int64 // /sys/class/power_supply/<Name>/current_max CurrentNow *int64 // /sys/class/power_supply/<Name>/current_now CycleCount *int64 // /sys/class/power_supply/<Name>/cycle_count EnergyAvg *int64 // /sys/class/power_supply/<Name>/energy_avg EnergyEmpty *int64 // /sys/class/power_supply/<Name>/energy_empty EnergyEmptyDesign *int64 // /sys/class/power_supply/<Name>/energy_empty_design EnergyFull *int64 // /sys/class/power_supply/<Name>/energy_full EnergyFullDesign *int64 // /sys/class/power_supply/<Name>/energy_full_design EnergyNow *int64 // /sys/class/power_supply/<Name>/energy_now Health string // /sys/class/power_supply/<Name>/health InputCurrentLimit *int64 // /sys/class/power_supply/<Name>/input_current_limit Manufacturer string // /sys/class/power_supply/<Name>/manufacturer ModelName string // /sys/class/power_supply/<Name>/model_name Online *int64 // /sys/class/power_supply/<Name>/online PowerAvg *int64 // /sys/class/power_supply/<Name>/power_avg PowerNow *int64 // /sys/class/power_supply/<Name>/power_now PrechargeCurrent *int64 // /sys/class/power_supply/<Name>/precharge_current Present *int64 // /sys/class/power_supply/<Name>/present Scope string // /sys/class/power_supply/<Name>/scope SerialNumber string // /sys/class/power_supply/<Name>/serial_number Status string // /sys/class/power_supply/<Name>/status Technology string // /sys/class/power_supply/<Name>/technology Temp *int64 // /sys/class/power_supply/<Name>/temp TempAlertMax *int64 // /sys/class/power_supply/<Name>/temp_alert_max TempAlertMin *int64 // /sys/class/power_supply/<Name>/temp_alert_min TempAmbient *int64 // /sys/class/power_supply/<Name>/temp_ambient TempAmbientMax *int64 // /sys/class/power_supply/<Name>/temp_ambient_max TempAmbientMin *int64 // /sys/class/power_supply/<Name>/temp_ambient_min TempMax *int64 // /sys/class/power_supply/<Name>/temp_max TempMin *int64 // /sys/class/power_supply/<Name>/temp_min TimeToEmptyAvg *int64 // /sys/class/power_supply/<Name>/time_to_empty_avg TimeToEmptyNow *int64 // /sys/class/power_supply/<Name>/time_to_empty_now TimeToFullAvg *int64 // /sys/class/power_supply/<Name>/time_to_full_avg TimeToFullNow *int64 // /sys/class/power_supply/<Name>/time_to_full_now Type string // /sys/class/power_supply/<Name>/type UsbType string // /sys/class/power_supply/<Name>/usb_type VoltageAvg *int64 // /sys/class/power_supply/<Name>/voltage_avg VoltageBoot *int64 // /sys/class/power_supply/<Name>/voltage_boot VoltageMax *int64 // /sys/class/power_supply/<Name>/voltage_max VoltageMaxDesign *int64 // /sys/class/power_supply/<Name>/voltage_max_design VoltageMin *int64 // /sys/class/power_supply/<Name>/voltage_min VoltageMinDesign *int64 // /sys/class/power_supply/<Name>/voltage_min_design VoltageNow *int64 // /sys/class/power_supply/<Name>/voltage_now VoltageOCV *int64 // /sys/class/power_supply/<Name>/voltage_ocv }
PowerSupply contains info from files in /sys/class/power_supply for a single power supply.
type PowerSupplyClass ¶
type PowerSupplyClass map[string]PowerSupply
PowerSupplyClass is a collection of every power supply in /sys/class/power_supply.
The map keys are the names of the power supplies.
type RaplZone ¶
type RaplZone struct { Name string // name of RAPL zone from file "name" Index int // index (different value for duplicate names) Path string // filesystem path of RaplZone MaxMicrojoules uint64 // max RAPL microjoule value }
RaplZone stores the information for one RAPL power zone.
func GetRaplZones ¶
GetRaplZones returns a slice of RaplZones. When RAPL files are not present, returns nil with error. - https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt
func (RaplZone) GetEnergyMicrojoules ¶
GetEnergyMicrojoules returns the current microjoule value from the zone energy counter https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt
type SASDevice ¶
type SASDevice struct { Name string // /sys/class/sas_device/<Name> SASAddress string // /sys/class/sas_device/<Name>/sas_address SASPhys []string // /sys/class/sas_device/<Name>/device/phy-* SASPorts []string // /sys/class/sas_device/<Name>/device/ports-* BlockDevices []string // /sys/class/sas_device/<Name>/device/target*/*/block/* }
type SASDeviceClass ¶
func (*SASDeviceClass) GetByName ¶
func (sdc *SASDeviceClass) GetByName(name string) *SASDevice
GetByName returns the SASDevice with the provided name.
func (*SASDeviceClass) GetByPhy ¶
func (sdc *SASDeviceClass) GetByPhy(name string) *SASDevice
GetByPhy finds the SASDevice that contains the provided PHY name.
func (*SASDeviceClass) GetByPort ¶
func (sdc *SASDeviceClass) GetByPort(name string) *SASDevice
GetByPort finds the SASDevice that contains the provided SAS Port name.
type SASHostClass ¶
func (*SASHostClass) GetByName ¶
func (shc *SASHostClass) GetByName(hostName string) *SASHost
GetByName returns the SASHost with the provided name.
func (*SASHostClass) GetByPhy ¶
func (shc *SASHostClass) GetByPhy(phyName string) *SASHost
GetByPhy finds the SASHost that contains the provided PHY name.
func (*SASHostClass) GetByPort ¶
func (shc *SASHostClass) GetByPort(portName string) *SASHost
GetByPort finds the SASHost that contains the provided SAS Port name.
type SASPhy ¶
type SASPhy struct { Name string // /sys/class/sas_phy/<Name> SASAddress string // /sys/class/sas_phy/<Name>/sas_address SASPort string // /sys/class/sas_phy/<Name>/device/ports DeviceType string // /sys/class/sas_phy/<Name>/device_type InitiatorPortProtocols []string // /sys/class/sas_phy/<Name>/initiator_port_protocols InvalidDwordCount int // /sys/class/sas_phy/<Name>/invalid_dword_count LossOfDwordSyncCount int // /sys/class/sas_phy/<Name>/loss_of_dword_sync_count MaximumLinkrate float64 // /sys/class/sas_phy/<Name>/maximum_linkrate MaximumLinkrateHW float64 // /sys/class/sas_phy/<Name>/maximum_linkrate_hw MinimumLinkrate float64 // /sys/class/sas_phy/<Name>/minimum_linkrate MinimumLinkrateHW float64 // /sys/class/sas_phy/<Name>/minimum_linkrate_hw NegotiatedLinkrate float64 // /sys/class/sas_phy/<Name>/negotiated_linkrate PhyIdentifier string // /sys/class/sas_phy/<Name>/phy_identifier PhyResetProblemCount int // /sys/class/sas_phy/<Name>/phy_reset_problem_count RunningDisparityErrorCount int // /sys/class/sas_phy/<Name>/running_disparity_error_count TargetPortProtocols []string // /sys/class/sas_phy/<Name>/target_port_protocols }
type SASPhyClass ¶
func (*SASPhyClass) GetByName ¶
func (spc *SASPhyClass) GetByName(name string) *SASPhy
GetByName returns the SASPhy with the provided name.
type SASPortClass ¶
func (*SASPortClass) GetByEndDevice ¶
func (spc *SASPortClass) GetByEndDevice(name string) *SASPort
GetByEndDevice finds the SASPort that contains the provided SAS end device name.
func (*SASPortClass) GetByExpander ¶
func (spc *SASPortClass) GetByExpander(name string) *SASPort
GetByExpander finds the SASPort that contains the provided SAS expander name.
func (*SASPortClass) GetByName ¶
func (spc *SASPortClass) GetByName(name string) *SASPort
GetByName returns the SASPort with the provided name.
func (*SASPortClass) GetByPhy ¶
func (spc *SASPortClass) GetByPhy(name string) *SASPort
GetByPhy finds the SASPort that contains the provided PHY name.
type SCSITape ¶
type SCSITape struct { Name string // /sys/class/scsi_tape/<Name> Counters SCSITapeCounters // /sys/class/scsi_tape/<Name>/statistics/* }
type SCSITapeClass ¶
type SCSITapeCounters ¶
type SCSITapeCounters struct { WriteNs uint64 // /sys/class/scsi_tape/<Name>/stats/write_ns ReadByteCnt uint64 // /sys/class/scsi_tape/<Name>/stats/read_byte_cnt IoNs uint64 // /sys/class/scsi_tape/<Name>/stats/io_ns WriteCnt uint64 // /sys/class/scsi_tape/<Name>/stats/write_cnt ResidCnt uint64 // /sys/class/scsi_tape/<Name>/stats/resid_cnt ReadNs uint64 // /sys/class/scsi_tape/<Name>/stats/read_ns InFlight uint64 // /sys/class/scsi_tape/<Name>/stats/in_flight OtherCnt uint64 // /sys/class/scsi_tape/<Name>/stats/other_cnt ReadCnt uint64 // /sys/class/scsi_tape/<Name>/stats/read_cnt WriteByteCnt uint64 // /sys/class/scsi_tape/<Name>/stats/write_byte_cnt }
type SystemCPUCpufreqStats ¶
type SystemCPUCpufreqStats struct { Name string CpuinfoCurrentFrequency *uint64 CpuinfoMinimumFrequency *uint64 CpuinfoMaximumFrequency *uint64 CpuinfoTransitionLatency *uint64 ScalingCurrentFrequency *uint64 ScalingMinimumFrequency *uint64 ScalingMaximumFrequency *uint64 AvailableGovernors string Driver string Governor string RelatedCpus string SetSpeed string }
SystemCPUCpufreqStats contains stats from `/sys/devices/system/cpu/cpu[0-9]*/cpufreq/...`.
type VMStat ¶
type VMStat struct { NrFreePages uint64 NrZoneInactiveAnon uint64 NrZoneActiveAnon uint64 NrZoneInactiveFile uint64 NrZoneActiveFile uint64 NrZoneUnevictable uint64 NrZoneWritePending uint64 NrMlock uint64 NrPageTablePages uint64 NrKernelStack uint64 NrBounce uint64 NrZspages uint64 NrFreeCma uint64 NumaHit uint64 NumaMiss uint64 NumaForeign uint64 NumaInterleave uint64 NumaLocal uint64 NumaOther uint64 NrInactiveAnon uint64 NrActiveAnon uint64 NrInactiveFile uint64 NrActiveFile uint64 NrUnevictable uint64 NrSlabReclaimable uint64 NrSlabUnreclaimable uint64 NrIsolatedAnon uint64 NrIsolatedFile uint64 WorkingsetNodes uint64 WorkingsetRefault uint64 WorkingsetActivate uint64 WorkingsetRestore uint64 WorkingsetNodereclaim uint64 NrAnonPages uint64 NrMapped uint64 NrFilePages uint64 NrDirty uint64 NrWriteback uint64 NrWritebackTemp uint64 NrShmem uint64 NrShmemHugepages uint64 NrShmemPmdmapped uint64 NrFileHugepages uint64 NrFilePmdmapped uint64 NrAnonTransparentHugepages uint64 NrVmscanWrite uint64 NrVmscanImmediateReclaim uint64 NrDirtied uint64 NrWritten uint64 NrKernelMiscReclaimable uint64 NrFollPinAcquired uint64 NrFollPinReleased uint64 }
type Vulnerability ¶
Vulnerability represents a single vulnerability extracted from /sys/devices/system/cpu/vulnerabilities/.
Source Files ¶
- class_cooling_device.go
- class_dmi.go
- class_drm.go
- class_drm_amdgpu.go
- class_fibrechannel.go
- class_infiniband.go
- class_nvme.go
- class_power_supply.go
- class_powercap.go
- class_sas_device.go
- class_sas_host.go
- class_sas_phy.go
- class_sas_port.go
- class_scsitape.go
- class_thermal.go
- clocksource.go
- doc.go
- fs.go
- mdraid.go
- net_class.go
- system_cpu.go
- vmstat_numa.go
- vulnerability.go