Documentation ¶
Index ¶
- Constants
- func IntToString(orig []int8) string
- func NewHealthInfo(ctx context.Context) (*health.HealthInfo, error)
- type Diskstat
- type Manager
- func (m *Manager) Cancel()
- func (m *Manager) GetAliveDuration() time.Duration
- func (m *Manager) GetHealthInfos() []*health.HealthInfo
- func (m *Manager) RegisterCPUAverageCallback(cb func(percent float64))
- func (m *Manager) RegisterCPUPercentCallback(cb func(percent float64))
- func (m *Manager) RegisterInfoChangedCallback(cb func(info []*health.HealthInfo))
- func (m *Manager) RegisterMemAverageCallback(cb func(percent float64))
- func (m *Manager) RegisterMemPercentCallback(cb func(percent float64))
- type UsageStat
Constants ¶
View Source
const HealthManagerPersistantKey = "7b14dc58c8e9f5b39ef92ee4ce7c0d93fa7d8836aa3d6b67c106608c2bd6ddb1-HealthManagerPersistantKey"
Variables ¶
This section is empty.
Functions ¶
func IntToString ¶
func NewHealthInfo ¶
func NewHealthInfo(ctx context.Context) (*health.HealthInfo, error)
NewHealthInfo 获取系统健康信息
2023.5.10: TODO: disk rate is waiting for fixing;
Types ¶
type Diskstat ¶
type Diskstat struct { Major uint // 0: major dev no Minor uint // 1: minor dev no Name string // 2: device name ReadComplete uint64 // 3: reads completed ReadMerged uint64 // 4: writes merged ReadSectors uint64 // 5: sectors read ReadMs uint // 6: ms spent reading WriteComplete uint64 // 7: reads completed WriteMerged uint64 // 8: writes merged WriteSectors uint64 // 9: sectors read WriteMs uint // 10: ms spent writing IOPending uint // 11: number of IOs currently in progress IOMs uint // 12: jiffies_to_msecs(part_stat_read(hd, io_ticks)) IOQueueMs uint // 13: jiffies_to_msecs(part_stat_read(hd, time_in_queue)) }
sample:
0 1 2 3 4 5 6 7 8 9 10 11 12 13
" 8 1 sda1 3774108 2444 30194552 637303 11746691 283841 529382982 90114806 0 1657750 90747516"
%4d %7d %s %lu %lu %lu %u %lu %lu %lu %u %u %u %u\n
^ from linux/block/genhd.c ~ line 1139
func ReadDiskstats ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewHealthInfoManager ¶
func (*Manager) GetAliveDuration ¶
func (*Manager) GetHealthInfos ¶
func (m *Manager) GetHealthInfos() []*health.HealthInfo
func (*Manager) RegisterCPUAverageCallback ¶
func (*Manager) RegisterCPUPercentCallback ¶
func (*Manager) RegisterInfoChangedCallback ¶
func (m *Manager) RegisterInfoChangedCallback(cb func(info []*health.HealthInfo))
func (*Manager) RegisterMemAverageCallback ¶
func (*Manager) RegisterMemPercentCallback ¶
type UsageStat ¶
type UsageStat struct { Path string `json:"path"` //Fstype string `json:"fstype"` Total uint64 `json:"total"` Free uint64 `json:"free"` Used uint64 `json:"used"` UsedPercent float64 `json:"usedPercent"` InodesTotal uint64 `json:"inodesTotal"` InodesUsed uint64 `json:"inodesUsed"` InodesFree uint64 `json:"inodesFree"` InodesUsedPercent float64 `json:"inodesUsedPercent"` }
Click to show internal directories.
Click to hide internal directories.