linux Available memory 추가
This commit is contained in:
parent
acc89db356
commit
84a1cc5a63
|
@ -29,6 +29,7 @@ type DiskIOInfo struct {
|
||||||
}
|
}
|
||||||
type MemoryInfo struct {
|
type MemoryInfo struct {
|
||||||
Total uint64 `json:"total_bytes"`
|
Total uint64 `json:"total_bytes"`
|
||||||
|
Available uint64 `json:"available_bytes"`
|
||||||
Used uint64 `json:"used_bytes"`
|
Used uint64 `json:"used_bytes"`
|
||||||
Buffers uint64 `json:"buffers_bytes"`
|
Buffers uint64 `json:"buffers_bytes"`
|
||||||
Cached uint64 `json:"cached_bytes"`
|
Cached uint64 `json:"cached_bytes"`
|
||||||
|
@ -172,6 +173,7 @@ func (p *OSMetricInfo) MarshalMemory() (name string, tags []map[string]string, f
|
||||||
{
|
{
|
||||||
"total_bytes": p.Memory.Total,
|
"total_bytes": p.Memory.Total,
|
||||||
"used_bytes": p.Memory.Used,
|
"used_bytes": p.Memory.Used,
|
||||||
|
"available_bytes": p.Memory.Available,
|
||||||
"buffers_bytes": p.Memory.Buffers,
|
"buffers_bytes": p.Memory.Buffers,
|
||||||
"cached_bytes": p.Memory.Cached,
|
"cached_bytes": p.Memory.Cached,
|
||||||
"free_bytes": p.Memory.Free,
|
"free_bytes": p.Memory.Free,
|
||||||
|
@ -216,6 +218,7 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
|
||||||
}
|
}
|
||||||
p.logger.Debugf("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
|
p.logger.Debugf("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
|
||||||
p.logger.Debugf("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
|
p.logger.Debugf("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
|
||||||
|
p.logger.Debugf("memory available: ", misc.FileSizeIEC(memoryInfo.Available))
|
||||||
p.logger.Debugf("memory buffers: ", misc.FileSizeIEC(memoryInfo.Buffers))
|
p.logger.Debugf("memory buffers: ", misc.FileSizeIEC(memoryInfo.Buffers))
|
||||||
p.logger.Debugf("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
|
p.logger.Debugf("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
|
||||||
p.logger.Debugf("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
|
p.logger.Debugf("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
|
||||||
|
@ -228,6 +231,7 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
|
||||||
|
|
||||||
info.Memory.Total = memoryInfo.Total
|
info.Memory.Total = memoryInfo.Total
|
||||||
info.Memory.Used = memoryInfo.Used
|
info.Memory.Used = memoryInfo.Used
|
||||||
|
info.Memory.Available = memoryInfo.Available
|
||||||
info.Memory.Buffers = memoryInfo.Buffers
|
info.Memory.Buffers = memoryInfo.Buffers
|
||||||
info.Memory.Cached = memoryInfo.Cached
|
info.Memory.Cached = memoryInfo.Cached
|
||||||
info.Memory.Free = memoryInfo.Free
|
info.Memory.Free = memoryInfo.Free
|
||||||
|
|
|
@ -33,11 +33,6 @@ func a() {
|
||||||
//SwapFree uint64
|
//SwapFree uint64
|
||||||
|
|
||||||
// Stats represents memory statistics for linux
|
// Stats represents memory statistics for linux
|
||||||
type Stats struct {
|
|
||||||
Total, Used, Buffers, Cached, Free, Available, Active, Inactive,
|
|
||||||
SwapTotal, SwapUsed, SwapCached, SwapFree uint64
|
|
||||||
MemAvailableEnabled bool
|
|
||||||
}
|
|
||||||
fmt.Println("memory total: ", misc.FileSizeIEC(memory.Total))
|
fmt.Println("memory total: ", misc.FileSizeIEC(memory.Total))
|
||||||
fmt.Println("memory used: ", misc.FileSizeIEC(memory.Used))
|
fmt.Println("memory used: ", misc.FileSizeIEC(memory.Used))
|
||||||
fmt.Println("memory buffers: ", misc.FileSizeIEC(memory.Buffers))
|
fmt.Println("memory buffers: ", misc.FileSizeIEC(memory.Buffers))
|
||||||
|
|
Loading…
Reference in New Issue