1
0
Fork 0

몇가지 오타 더 수정

This commit is contained in:
Sangbum Kim 2018-07-09 04:59:34 +09:00
parent b545e1fc47
commit be64e4fa34
2 changed files with 36 additions and 2 deletions

View File

@ -66,6 +66,9 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
}
}()
if err !=nil{
return
}
p.logger.Debugf("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
p.logger.Debugf("memory active: ", misc.FileSizeIEC(memoryInfo.Active))
p.logger.Debugf("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
@ -102,6 +105,9 @@ func (p *osMetric) readLoadStat(info *OSMetricInfo, errChan chan<- error, waiter
}
}()
if err !=nil{
return
}
p.logger.Debugf("load Loadavg1: %f \n", load.Loadavg1)
p.logger.Debugf("load Loadavg5: %f \n", load.Loadavg5)
p.logger.Debugf("load Loadavg15: %f \n", load.Loadavg15)
@ -126,6 +132,9 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
}
}()
if err !=nil{
return
}
netIoMap := make(map[string]NetIOInfo)
for _, netio := range netios {
p.logger.Debugf("netio name: ", netio.Name)
@ -155,6 +164,9 @@ func (p *osMetric) readUptimeStat(info *OSMetricInfo, errChan chan<- error, wait
}
}()
if err !=nil{
return
}
p.logger.Debugf("readUptimeStat: %s\n", durafmt.Parse(ut).String())
info.Uptime = ut
@ -175,6 +187,9 @@ func (p *osMetric) readCpuStat(info *OSMetricInfo, errChan chan<- error, waiter
}
}()
if err !=nil{
return
}
p.logger.Debugf("readCpuStat: idle=%d\n", ct.Idle)
p.logger.Debugf("readCpuStat: nice=%d\n", ct.Nice)
p.logger.Debugf("readCpuStat: system=%d\n", ct.System)

View File

@ -12,6 +12,7 @@ import (
"amuz.es/src/infra/goutils/misc"
"time"
"go.uber.org/multierr"
"sync"
)
type NetIOInfo struct {
@ -61,7 +62,7 @@ type OSMetricInfo struct {
Uptime time.Duration
CPU CPUInfo
DiskIO DiskIOInfo
DiskIO map[string]DiskIOInfo
At time.Time
}
@ -79,6 +80,9 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
}
}()
if err !=nil{
return
}
p.logger.Debugf("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
p.logger.Debugf("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
p.logger.Debugf("memory buffers: ", misc.FileSizeIEC(memoryInfo.Buffers))
@ -118,6 +122,9 @@ func (p *osMetric) readLoadStat(info *OSMetricInfo, errChan chan<- error, waiter
}
}()
if err !=nil{
return
}
p.logger.Debugf("load Loadavg1: %f \n", load.Loadavg1)
p.logger.Debugf("load Loadavg5: %f \n", load.Loadavg5)
p.logger.Debugf("load Loadavg15: %f \n", load.Loadavg15)
@ -142,6 +149,9 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
}
}()
if err !=nil{
return
}
netIoMap := make(map[string]NetIOInfo)
for _, netio := range netios {
p.logger.Debugf("netio name: ", netio.Name)
@ -171,6 +181,9 @@ func (p *osMetric) readUptimeStat(info *OSMetricInfo, errChan chan<- error, wait
}
}()
if err !=nil{
return
}
p.logger.Debugf("readUptimeStat: %s\n", durafmt.Parse(ut).String())
info.Uptime = ut
@ -191,6 +204,9 @@ func (p *osMetric) readCpuStat(info *OSMetricInfo, errChan chan<- error, waiter
}
}()
if err !=nil{
return
}
p.logger.Debugf("cpu user: %d\n", ct.User)
p.logger.Debugf("cpu nice: %d\n", ct.Nice)
p.logger.Debugf("cpu system: %d\n", ct.System)
@ -234,6 +250,9 @@ func (p *osMetric) readDiskStat(info *OSMetricInfo, errChan chan<- error, waiter
errChan <- err
}
}()
if err !=nil{
return
}
diskIoMap := make(map[string]DiskIOInfo)
for _, dsk := range diskinfos {
@ -241,7 +260,7 @@ func (p *osMetric) readDiskStat(info *OSMetricInfo, errChan chan<- error, waiter
p.logger.Debugf("disk read: ", misc.FileSizeIEC(dsk.ReadsCompleted))
p.logger.Debugf("disk written: ", misc.FileSizeIEC(dsk.WritesCompleted))
diskIoMap[dsk.Name] = DiskIOInfo{
Name: netio.Name,
Name: dsk.Name,
ReadsCompletedBytes: dsk.ReadsCompleted,
WritesCompletedBytes: dsk.WritesCompleted,
}