1
0
Fork 0

로그 수정.

This commit is contained in:
Sangbum Kim 2018-07-10 02:05:41 +09:00
parent 69ab132133
commit f9ed42f0ec
3 changed files with 66 additions and 66 deletions

View File

@ -153,7 +153,7 @@ func (m *influxMetric) getOsMetric(points *[]*client.Point, info *producer.OSMet
tags, fields := tagsSlice[i], fieldsSlice[i]
point, err := client.NewPoint(name, tags, fields, info.At)
if err != nil {
m.logger.Debugf("os matric name %s err %s", name, err)
m.logger.Errorf("os matric name %s err %s", name, err)
continue
}
*points = append(*points, point)
@ -172,7 +172,7 @@ func (m *influxMetric) getProcessorPoint(points *[]*client.Point, datas []proces
}
point, err := client.NewPoint("processor", tags, fields, at)
if err != nil {
m.logger.Debugf("processor id %d err %s", id, err)
m.logger.Errorf("processor id %d err %s", id, err)
continue
}
*points = append(*points, point)

View File

@ -177,15 +177,15 @@ 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))
p.logger.Debugf("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
p.logger.Debugf("memory inactive: ", misc.FileSizeIEC(memoryInfo.Inactive))
p.logger.Debugf("memory swapFree: ", misc.FileSizeIEC(memoryInfo.SwapFree))
p.logger.Debugf("memory swapTotal: ", misc.FileSizeIEC(memoryInfo.SwapTotal))
p.logger.Debugf("memory swapUsed: ", misc.FileSizeIEC(memoryInfo.SwapUsed))
p.logger.Debugf("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
p.logger.Debug("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
p.logger.Debug("memory active: ", misc.FileSizeIEC(memoryInfo.Active))
p.logger.Debug("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
p.logger.Debug("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
p.logger.Debug("memory inactive: ", misc.FileSizeIEC(memoryInfo.Inactive))
p.logger.Debug("memory swapFree: ", misc.FileSizeIEC(memoryInfo.SwapFree))
p.logger.Debug("memory swapTotal: ", misc.FileSizeIEC(memoryInfo.SwapTotal))
p.logger.Debug("memory swapUsed: ", misc.FileSizeIEC(memoryInfo.SwapUsed))
p.logger.Debug("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
info.Memory.Total = memoryInfo.Total
info.Memory.Active = memoryInfo.Active
@ -216,9 +216,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)
p.logger.Debugf("load Loadavg1: %f", load.Loadavg1)
p.logger.Debugf("load Loadavg5: %f", load.Loadavg5)
p.logger.Debugf("load Loadavg15: %f", load.Loadavg15)
info.Load.Avg1 = load.Loadavg1
info.Load.Avg5 = load.Loadavg5
@ -245,9 +245,9 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
}
netIoMap := make(map[string]NetIOInfo)
for _, netio := range netios {
p.logger.Debugf("netio name: ", netio.Name)
p.logger.Debugf("netio rxBytes: ", misc.FileSizeIEC(netio.RxBytes))
p.logger.Debugf("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
p.logger.Debug("netio name: ", netio.Name)
p.logger.Debug("netio rxBytes: ", misc.FileSizeIEC(netio.RxBytes))
p.logger.Debug("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
netIoMap[netio.Name] = NetIOInfo{
Name: netio.Name,
RxBytes: netio.RxBytes,
@ -275,7 +275,7 @@ func (p *osMetric) readUptimeStat(info *OSMetricInfo, errChan chan<- error, wait
if err != nil {
return
}
p.logger.Debugf("readUptimeStat: %s\n", durafmt.Parse(ut).String())
p.logger.Debugf("readUptimeStat: %s", durafmt.Parse(ut).String())
info.Uptime = ut
return
@ -298,15 +298,15 @@ 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)
p.logger.Debugf("readCpuStat: total=%d\n", ct.Total)
p.logger.Debugf("readCpuStat: user=%d\n", ct.User)
p.logger.Debugf("readCpuStat: idle=%f%%\n", float64(ct.Idle*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: nice=%f%%\n", float64(ct.Nice*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: system=%f%%\n", float64(ct.System*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: user=%f%%\n", float64(ct.User*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: idle=%d", ct.Idle)
p.logger.Debugf("readCpuStat: nice=%d", ct.Nice)
p.logger.Debugf("readCpuStat: system=%d", ct.System)
p.logger.Debugf("readCpuStat: total=%d", ct.Total)
p.logger.Debugf("readCpuStat: user=%d", ct.User)
p.logger.Debugf("readCpuStat: idle=%f%%", float64(ct.Idle*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: nice=%f%%", float64(ct.Nice*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: system=%f%%", float64(ct.System*100)/float64(ct.Total))
p.logger.Debugf("readCpuStat: user=%f%%", float64(ct.User*100)/float64(ct.Total))
info.CPU.Idle = float64(ct.Idle*100) / float64(ct.Total)
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total)

View File

@ -216,18 +216,18 @@ 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 available: ", misc.FileSizeIEC(memoryInfo.Available))
p.logger.Debugf("memory buffers: ", misc.FileSizeIEC(memoryInfo.Buffers))
p.logger.Debugf("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
p.logger.Debugf("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
p.logger.Debugf("memory active: ", misc.FileSizeIEC(memoryInfo.Active))
p.logger.Debugf("memory inactive: ", misc.FileSizeIEC(memoryInfo.Inactive))
p.logger.Debugf("memory swapTotal: ", misc.FileSizeIEC(memoryInfo.SwapTotal))
p.logger.Debugf("memory swapUsed: ", misc.FileSizeIEC(memoryInfo.SwapUsed))
p.logger.Debugf("memory swapCached: ", misc.FileSizeIEC(memoryInfo.SwapCached))
p.logger.Debugf("memory swapFree: ", misc.FileSizeIEC(memoryInfo.SwapFree))
p.logger.Debug("memory total: ", misc.FileSizeIEC(memoryInfo.Total))
p.logger.Debug("memory used: ", misc.FileSizeIEC(memoryInfo.Used))
p.logger.Debug("memory available: ", misc.FileSizeIEC(memoryInfo.Available))
p.logger.Debug("memory buffers: ", misc.FileSizeIEC(memoryInfo.Buffers))
p.logger.Debug("memory cached: ", misc.FileSizeIEC(memoryInfo.Cached))
p.logger.Debug("memory free: ", misc.FileSizeIEC(memoryInfo.Free))
p.logger.Debug("memory active: ", misc.FileSizeIEC(memoryInfo.Active))
p.logger.Debug("memory inactive: ", misc.FileSizeIEC(memoryInfo.Inactive))
p.logger.Debug("memory swapTotal: ", misc.FileSizeIEC(memoryInfo.SwapTotal))
p.logger.Debug("memory swapUsed: ", misc.FileSizeIEC(memoryInfo.SwapUsed))
p.logger.Debug("memory swapCached: ", misc.FileSizeIEC(memoryInfo.SwapCached))
p.logger.Debug("memory swapFree: ", misc.FileSizeIEC(memoryInfo.SwapFree))
info.Memory.Total = memoryInfo.Total
info.Memory.Used = memoryInfo.Used
@ -260,9 +260,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)
p.logger.Debugf("load Loadavg1: %f", load.Loadavg1)
p.logger.Debugf("load Loadavg5: %f", load.Loadavg5)
p.logger.Debugf("load Loadavg15: %f", load.Loadavg15)
info.Load.Avg1 = load.Loadavg1
info.Load.Avg5 = load.Loadavg5
@ -289,9 +289,9 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
}
netIoMap := make(map[string]NetIOInfo)
for _, netio := range netios {
p.logger.Debugf("netio name: ", netio.Name)
p.logger.Debugf("netio rxBytes: ", misc.FileSizeIEC(netio.RxBytes))
p.logger.Debugf("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
p.logger.Debug("netio name: ", netio.Name)
p.logger.Debug("netio rxBytes: ", misc.FileSizeIEC(netio.RxBytes))
p.logger.Debug("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
netIoMap[netio.Name] = NetIOInfo{
Name: netio.Name,
RxBytes: netio.RxBytes,
@ -319,7 +319,7 @@ func (p *osMetric) readUptimeStat(info *OSMetricInfo, errChan chan<- error, wait
if err != nil {
return
}
p.logger.Debugf("readUptimeStat: %s\n", durafmt.Parse(ut).String())
p.logger.Debugf("readUptimeStat: %s", durafmt.Parse(ut).String())
info.Uptime = ut
return
@ -342,24 +342,24 @@ 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)
p.logger.Debugf("cpu idle: %d\n", ct.Idle)
p.logger.Debugf("cpu iowait: %d\n", ct.Iowait)
p.logger.Debugf("cpu irq: %d\n", ct.Irq)
p.logger.Debugf("cpu softirq: %d\n", ct.Softirq)
p.logger.Debugf("cpu steal: %d\n", ct.Steal)
p.logger.Debugf("cpu total: %d\n", ct.Total)
p.logger.Debugf("cpu user: %d", ct.User)
p.logger.Debugf("cpu nice: %d", ct.Nice)
p.logger.Debugf("cpu system: %d", ct.System)
p.logger.Debugf("cpu idle: %d", ct.Idle)
p.logger.Debugf("cpu iowait: %d", ct.Iowait)
p.logger.Debugf("cpu irq: %d", ct.Irq)
p.logger.Debugf("cpu softirq: %d", ct.Softirq)
p.logger.Debugf("cpu steal: %d", ct.Steal)
p.logger.Debugf("cpu total: %d", ct.Total)
p.logger.Debugf("cpu user: %f%%\n", float64(ct.User*100)/float64(ct.Total))
p.logger.Debugf("cpu nice: %f%%\n", float64(ct.Nice*100)/float64(ct.Total))
p.logger.Debugf("cpu system: %f%%\n", float64(ct.System*100)/float64(ct.Total))
p.logger.Debugf("cpu idle: %f%%\n", float64(ct.Idle*100)/float64(ct.Total))
p.logger.Debugf("cpu iowait: %f%%\n", float64(ct.Iowait*100)/float64(ct.Total))
p.logger.Debugf("cpu irq: %f%%\n", float64(ct.Irq*100)/float64(ct.Total))
p.logger.Debugf("cpu softirq: %f%%\n", float64(ct.Softirq*100)/float64(ct.Total))
p.logger.Debugf("cpu steal: %f%%\n", float64(ct.Steal*100)/float64(ct.Total))
p.logger.Debugf("cpu user: %f%%", float64(ct.User*100)/float64(ct.Total))
p.logger.Debugf("cpu nice: %f%%", float64(ct.Nice*100)/float64(ct.Total))
p.logger.Debugf("cpu system: %f%%", float64(ct.System*100)/float64(ct.Total))
p.logger.Debugf("cpu idle: %f%%", float64(ct.Idle*100)/float64(ct.Total))
p.logger.Debugf("cpu iowait: %f%%", float64(ct.Iowait*100)/float64(ct.Total))
p.logger.Debugf("cpu irq: %f%%", float64(ct.Irq*100)/float64(ct.Total))
p.logger.Debugf("cpu softirq: %f%%", float64(ct.Softirq*100)/float64(ct.Total))
p.logger.Debugf("cpu steal: %f%%", float64(ct.Steal*100)/float64(ct.Total))
info.CPU.User = float64(ct.User*100) / float64(ct.Total)
info.CPU.Nice = float64(ct.Nice*100) / float64(ct.Total)
@ -391,9 +391,9 @@ func (p *osMetric) readDiskStat(info *OSMetricInfo, errChan chan<- error, waiter
diskIoMap := make(map[string]DiskIOInfo)
for _, dsk := range diskinfos {
p.logger.Debugf("disk name: ", dsk.Name)
p.logger.Debugf("disk read: ", misc.FileSizeIEC(dsk.ReadsCompleted))
p.logger.Debugf("disk written: ", misc.FileSizeIEC(dsk.WritesCompleted))
p.logger.Debug("disk name: ", dsk.Name)
p.logger.Debug("disk read: ", misc.FileSizeIEC(dsk.ReadsCompleted))
p.logger.Debug("disk written: ", misc.FileSizeIEC(dsk.WritesCompleted))
diskIoMap[dsk.Name] = DiskIOInfo{
Name: dsk.Name,
ReadsCompletedBytes: dsk.ReadsCompleted,