Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func GetRunningPod(ctx context.Context, clnt *client, nname types.NamespacedName) (*corev1.Pod, error)
- func ListAllRunningPods(ctx context.Context, clnt *client) ([]*corev1.Pod, error)
- func ListRunningPodsWith(ctx context.Context, clnt *client, namePrefix, hostIP string) ([]*corev1.Pod, error)
- func LocateSsa() (string, error)
- func LogSelfIdent(log logr.Logger)
- func ParseSsaVersion(dat string) (string, error)
- func ProbePrintDevices() error
- func Progname() string
- func RunDevicesExporter(port int) error
- func RunSsaVersion() (string, error)
- func Version() string
- type BlkdevID
- type BlkdevIOInfo
- type BlkdevIOStat
- type BlkdevInfo
- type BlkdevMap
- type BlkdevQueueStats
- type Ident
- type NodeInfo
- type ProcFS
- type PseudoFS
- func (pfs *PseudoFS) IsDir(subs ...string) (bool, error)
- func (pfs *PseudoFS) ParseBool(s string) (bool, error)
- func (pfs *PseudoFS) ParseFloat(s string) (float64, error)
- func (pfs *PseudoFS) ParseInt(s string) (int, error)
- func (pfs *PseudoFS) ParseMultUint64(s string, mul uint64) (uint64, error)
- func (pfs *PseudoFS) ParseUint32(s string) (uint32, error)
- func (pfs *PseudoFS) ParseUint64(s string) (uint64, error)
- func (pfs *PseudoFS) ReadDir(subs ...string) ([]string, error)
- func (pfs *PseudoFS) ReadFile(subs ...string) (string, error)
- func (pfs *PseudoFS) ReadFileAsBool(subs ...string) (bool, error)
- func (pfs *PseudoFS) ReadFileAsInt(subs ...string) (int, error)
- func (pfs *PseudoFS) ReadFileAsUInt32(subs ...string) (uint32, error)
- func (pfs *PseudoFS) ReadFileAsUInt64(subs ...string) (uint64, error)
- func (pfs *PseudoFS) ReadFileFields(subs ...string) ([]string, error)
- func (pfs *PseudoFS) ReadFileLines(subs ...string) ([]string, error)
- func (pfs *PseudoFS) ReadFileTrim(subs ...string) (string, error)
- func (pfs *PseudoFS) SplitFields(s string, min int) ([]string, error)
- type SsaArray
- type SsaConfigInfo
- type SsaEntry
- type SsaLogicalDrive
- type SsaLogicalDriveInfo
- type SsaMap
- type SsaPhysicalDrive
- type SsaPhysicalDriveInfo
- type SsaSlot
- type SysFS
- func (sysfs *SysFS) BlkdevInfo(dev string) (*BlkdevInfo, error)
- func (sysfs *SysFS) BlockDeviceQueueSub(dev string) *PseudoFS
- func (sysfs *SysFS) BlockDeviceSub(dev string) *PseudoFS
- func (sysfs *SysFS) BlockQueueStats(dev string) (*BlkdevQueueStats, error)
- func (sysfs *SysFS) BlockStat(dev string) (*BlkdevIOStat, error)
- func (sysfs *SysFS) IsBlock(name string) (bool, error)
- func (sysfs *SysFS) ListBlockDevices() ([]string, error)
- func (sysfs *SysFS) Sub(subpath string) *PseudoFS
- type SysLoadAvg
- type SysUname
Constants ¶
const ( Kilo = 1 << 10 Mega = 1 << 20 Giga = 1 << 30 Tera = 1 << 40 Peta = 1 << 50 SectorSize = 512 )
const ( HostnameEnvKey = "HOSTNAME" PodNameEnvKey = "POD_NAME" PodNamespaceEnvKey = "POD_NAMESPACE" PodIPEnvKey = "POD_IP" HostIPEnvKey = "HOST_IP" )
Variables ¶
var (
DefaultMetricsPort = int(8080)
)
Functions ¶
func GetRunningPod ¶
func ListAllRunningPods ¶
func ListRunningPodsWith ¶
func LogSelfIdent ¶
func ParseSsaVersion ¶
func ProbePrintDevices ¶
func ProbePrintDevices() error
func RunDevicesExporter ¶
func RunSsaVersion ¶
Types ¶
type BlkdevIOInfo ¶
type BlkdevIOInfo struct { BlkdevID BlkdevIOStat }
func DescoveBlockDevicesIO ¶
func DescoveBlockDevicesIO(procfs *ProcFS, sysfs *SysFS) ([]BlkdevIOInfo, error)
type BlkdevIOStat ¶
type BlkdevIOStat struct { ReadsIOs uint64 `json:"readios"` ReadsMerged uint64 `json:"readsmerged"` ReadsBytes uint64 `json:"readsbytes"` ReadTimeMS uint64 `json:"readtimems"` WritesIOs uint64 `json:"writeios"` WritesMerged uint64 `json:"writesmerged"` WritesBytes uint64 `json:"writesbytes"` WriteTimeMS uint64 `json:"writetimems"` InFlight uint64 `json:"inflight"` IOTimeMS uint64 `json:"iotimems"` WeightedIOTimeMS uint64 `json:"weightediotimems"` }
BlkdevIOStat represents procfs diskstats info https://www.kernel.org/doc/Documentation/iostats.txt, https://www.kernel.org/doc/Documentation/block/stat.txt, https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
type BlkdevInfo ¶
type BlkdevInfo struct { Major uint32 `json:"major"` Minor uint32 `json:"minor"` Name string `json:"name"` Size uint64 `json:"size"` Vendor string `json:"vendor"` Model string `json:"model"` Readonly bool `json:"readonly"` }
BlkdevInfo contains collection of raw information under /sys/block/<disk>/... https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block
func DiscoverBlkdevInfo ¶
func DiscoverBlkdevInfo(procfs *ProcFS, sysfs *SysFS) ([]BlkdevInfo, error)
type BlkdevMap ¶
type BlkdevMap struct { IDs map[string]BlkdevID IOStats map[string]*BlkdevIOStat QStats map[string]*BlkdevQueueStats }
type BlkdevQueueStats ¶
type BlkdevQueueStats struct { AddRandom bool `json:"addrandom"` DAX bool `json:"dax"` DiscardGranularity uint64 `json:"discardgranularity"` DiscardMaxHWBytes uint64 `json:"discardmaxhwbytes"` DiscardMaxBytes uint64 `json:"discardmaxbytes"` FUA bool `json:"fua"` HWSectorSize uint32 `json:"hwsectorsize"` IOPoll bool `json:"iopoll"` IOPollDelay int `json:"iopolldelay"` IOTimeout uint64 `json:"iotimeout"` IOStats bool `json:"iostats"` LogicalBlockSize uint64 `json:"logicalblocksize"` MaxHWSectorsKB uint64 `json:"maxhwsectorskb"` MaxIntegritySegments uint64 `json:"maxintegritysegments"` MaxSectorsKB uint64 `json:"maxsectorskb"` MaxSegments uint64 `json:"maxsegments"` MaxSegmentSize uint64 `json:"maxsegmentsize"` MinimumIOSize uint64 `json:"minimumiosize"` NoMerges uint32 `json:"nomerges"` NRRequests uint64 `json:"nrrequests"` OptimalIOSize uint64 `json:"optimaliosize"` PhysicalBlockSize uint64 `json:"physicalblocksize"` ReadAHeadKB uint64 `json:"readaheadkb"` Rotational bool `json:"rotational"` RQAffinity uint32 `json:"rqaffinity"` Scheduler string `json:"scheduler"` WriteCache string `json:"writecache"` WriteSameMaxBytes uint64 `json:"writesamemaxbytes"` WBTLatUSec int `json:"wbtlatusec"` Zoned string `json:"zoned"` ZoneWriteGranularity int `json:"zonewritegranularity"` }
BlkdevQueueStats represents sysfs block-queue info https://www.kernel.org/doc/Documentation/block/queue-sysfs.txt https://www.kernel.org/doc/html/latest/block/queue-sysfs.html
type Ident ¶
type ProcFS ¶
type ProcFS struct {
PseudoFS
}
func (*ProcFS) Devices ¶
Devices parses "/proc/devices" into maps of character-devices and block-devices, indexed by device-number. See man(5) proc.
func (*ProcFS) DiskStats ¶
func (procfs *ProcFS) DiskStats() ([]BlkdevIOInfo, error)
DiskStats converts "/proc/diskstats" info into BlkdevIOStat representation. See: https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
func (*ProcFS) LoadAvg ¶
func (procfs *ProcFS) LoadAvg() (*SysLoadAvg, error)
type PseudoFS ¶
type PseudoFS struct {
Prefix string
}
func (*PseudoFS) ParseMultUint64 ¶
func (*PseudoFS) ReadFileAsUInt32 ¶
func (*PseudoFS) ReadFileAsUInt64 ¶
func (*PseudoFS) ReadFileFields ¶
func (*PseudoFS) ReadFileLines ¶
type SsaArray ¶
type SsaArray struct { SsaEntry LogicalDrive []*SsaLogicalDrive PhysicalDrive []*SsaPhysicalDrive }
type SsaConfigInfo ¶
type SsaConfigInfo struct {
Slots []*SsaSlot
}
func ParseSsaShowConfig ¶
func ParseSsaShowConfig(dat string) (*SsaConfigInfo, error)
func RunSsaShowConfig ¶
func RunSsaShowConfig() (*SsaConfigInfo, error)
type SsaLogicalDrive ¶
type SsaLogicalDrive struct {
SsaEntry
}
type SsaLogicalDriveInfo ¶
type SsaMap ¶
type SsaMap struct {
DevMap map[string]SsaLogicalDriveInfo
}
func ParseConfigToLogical ¶
func ParseConfigToLogical(config *SsaConfigInfo) (*SsaMap, error)
type SsaPhysicalDrive ¶
type SsaPhysicalDrive struct {
SsaEntry
}
type SsaPhysicalDriveInfo ¶
type SsaPhysicalDriveInfo struct { ID string `json:"id"` Box string `json:"box"` Bay string `json:"bay"` Size string `json:"size"` SizeBytes uint64 `json:"sizebytes"` Status string `json:"status"` Serial string `json:"serial"` TempCurr int64 `json:"tempcurr"` TempMaxi int64 `json:"tempmaxi"` UniqueID string `json:"uniqueid"` PowerHours int64 `json:"powerhours"` // nolint:misspell }
type SysFS ¶
type SysFS struct {
PseudoFS
}
func (*SysFS) BlkdevInfo ¶
func (sysfs *SysFS) BlkdevInfo(dev string) (*BlkdevInfo, error)
BlkdevInfo parses raw information from under /sys/block/<dev>/...
func (*SysFS) BlockDeviceQueueSub ¶
func (*SysFS) BlockDeviceSub ¶
func (*SysFS) BlockQueueStats ¶
func (sysfs *SysFS) BlockQueueStats(dev string) (*BlkdevQueueStats, error)
BlockQueueStats parses /sys/block/<dev>/queue
func (*SysFS) BlockStat ¶
func (sysfs *SysFS) BlockStat(dev string) (*BlkdevIOStat, error)
BlockStat parses /sys/block/<device>/stat https://www.kernel.org/doc/Documentation/block/stat.txt