Documentation
¶
Index ¶
- func GetProcPath(paths ...string) string
- func GetSysUptime() (uptime float64, idleTime float64, err error)
- type BlockDev
- type ChronyStat
- type InsightInfo
- type Meta
- type MountInfo
- type Options
- type ProcessStat
- type RlimitUsage
- type SecLimitField
- type SlabData
- type SlabInfo
- type Socket
- type SysCfg
- type TimeStat
- type TunableParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProcPath ¶
func GetSysUptime ¶
Types ¶
type BlockDev ¶
type BlockDev struct {
Name string `json:"name,omitempty"`
Partition bool `json:"partition,omitempty"`
Mount MountInfo `json:"mount,omitempty"`
UUID string `json:"uuid,omitempty"`
Sectors uint64 `json:"sectors,omitempty"`
Size uint64 `json:"size,omitempty"`
SubDev []BlockDev `json:"subdev,omitempty"`
Holder []string `json:"holder_of,omitempty"`
Slave []string `json:"slave_of,omitempty"`
Rotational string `json:"rotational,omitempty"`
}
BlockDev is similar to blkDev_cxt in lsblk (from util-linux) contains metadata of a block device
func GetPartitionStats ¶
func GetPartitionStats() []BlockDev
type ChronyStat ¶
type ChronyStat struct {
ReferenceID string `json:"referenceid,omitempty"`
Stratum int `json:"stratum,omitempty"`
RefTime string `json:"ref_time,omitempty"`
SystemTime string `json:"system_time,omitempty"`
LastOffset float64 `json:"last_offset,omitempty"` // millisecond
RMSOffset float64 `json:"rms_offset,omitempty"` // millisecond
Frequency float64 `json:"frequency,omitempty"` // millisecond
ResidualFreq string `json:"residual_freq,omitempty"`
Skew string `json:"skew,omitempty"`
RootDelay float64 `json:"root_delay,omitempty"` // millisecond
RootDispersion float64 `json:"root_dispersion,omitempty"` // millisecond
UpdateInterval float64 `json:"update_interval,omitempty"` // millisecond
LeapStatus string `json:"leap_status,omitempty"`
}
type InsightInfo ¶
type InsightInfo struct {
Meta Meta `json:"meta"`
SysInfo si.SysInfo `json:"sysinfo,omitempty"`
NTP TimeStat `json:"ntp,omitempty"`
ChronyStat ChronyStat `json:"chrony,omitempty"`
Partitions []BlockDev `json:"partitions,omitempty"`
ProcStats []ProcessStat `json:"proc_stats,omitempty"`
EpollExcl bool `json:"epoll_exclusive,omitempty"`
SysConfig *SysCfg `json:"system_configs,omitempty"`
DMesg []*kmsg.Msg `json:"dmesg,omitempty"`
Sockets []Socket `json:"sockets,omitempty"`
SlabInfo []SlabInfo `json:"slabinfo,omitempty"`
}
InsightInfo are information gathered from the system
func (*InsightInfo) GetInfo ¶
func (info *InsightInfo) GetInfo(opts Options)
type Meta ¶
type Meta struct {
Timestamp time.Time `json:"timestamp"`
UPTime float64 `json:"uptime,omitempty"`
IdleTime float64 `json:"idle_time,omitempty"`
SiVer string `json:"sysinfo_ver"`
Version string `json:"version"`
GitBranch string `json:"git_branch"`
GitCommit string `json:"git_commit"`
GoVersion string `json:"go_version"`
}
Meta are information about insight itself
type MountInfo ¶
type MountInfo struct {
MountPoint string `json:"mount_point,omitempty"`
FSType string `json:"filesystem,omitempty"`
// Mount options used to mount this device
Options string `json:"mount_options,omitempty"`
}
MountInfo is the metadata of a mounted device
type ProcessStat ¶
type ProcessStat struct {
Name string `json:"name"`
Pid int32 `json:"pid"`
Exec string `json:"exec"`
Cmdline string `json:"cmd"`
Status string `json:"status"`
StartTime float64 `json:"start_time"`
CPUTimes *cpu.TimesStat `json:"cpu_times"`
Memory *process.MemoryInfoStat `json:"memory"`
Rlimit []RlimitUsage `json:"resource_limit"`
}
ProcessStat contains basic info of a running process
func GetProcessStats ¶
func GetProcessStats() []ProcessStat
type RlimitUsage ¶
type RlimitUsage struct {
Resource string `json:"resource"`
Soft int64 `json:"soft"`
Hard int64 `json:"hard"`
Used uint64 `json:"used"`
}
RlimitUsage is the resource limit usage of a process
type SecLimitField ¶
type SecLimitField struct {
Domain string `json:"domain"`
Type string `json:"type"`
Item string `json:"item"`
Value int `json:"value"`
}
SecLimitField is the config field in security limit file
type SlabInfo ¶
type SlabInfo struct {
Name string `json:"name"`
ActiveObjs int `json:"active_objs"`
NumObjs int `json:"num_objs"`
ObjSize int `json:"objsize"`
ObjPerSlab int `json:"objperslab"`
PagesPerSlab int `json:"pagesperslab"`
Tunables TunableParams `json:"tunables"`
SlabData SlabData `json:"slabdata"`
}
SlabInfo is an item of kernel slab allocator statistic, it is one line as in /proc/slabinfo We only support slabinfo v2.1, which first appeared in Linux 2.6.10 and has not changed until Linux 5.16. For detailed documentation, refer to slabinfo(5) manual.
func GetSlabInfo ¶
GetSlabInfo reads /proc/cpuinfo and parses its content
type Socket ¶
type Socket struct {
Family uint8 `json:"family"`
State uint8 `json:"state"`
SourceAddr string `json:"source_addr"`
SourcePort uint16 `json:"source_port"`
DestAddr string `json:"dest_addr"`
DestPort uint16 `json:"dest_port"`
}
func GetIPV4Sockets ¶
type SysCfg ¶
type SysCfg struct {
SecLimit []SecLimitField `json:"sec_limit,omitempty"`
SysCtl map[string]string `json:"sysctl,omitempty"`
}
SysCfg are extra system configs we collected
type TimeStat ¶
type TimeStat struct {
Ver string `json:"version,omitempty"`
Sync string `json:"sync,omitempty"`
Stratum int `json:"stratum,omitempty"`
Precision int `json:"precision,omitempty"`
Rootdelay float64 `json:"rootdelay,omitempty"`
Rootdisp float64 `json:"rootdisp,omitempty"`
Refid string `json:"refid,omitempty"`
Peer int `json:"peer,omitempty"`
TC int `json:"tc,omitempty"`
Mintc int `json:"mintc,omitempty"`
Offset float64 `json:"offset,omitempty"`
Frequency float64 `json:"frequency,omitempty"`
Jitter float64 `json:"jitter,omitempty"`
ClkJitter float64 `json:"clk_jitter,omitempty"`
ClkWander float64 `json:"clk_wander,omitempty"`
Status string `json:"status,omitempty"`
}
type TunableParams ¶
TunableParams is the tunable parameters for the corresponding cache