uint제거 kbytes로 옮김
This commit is contained in:
parent
8c1dcace29
commit
505d6b8332
|
@ -17,20 +17,20 @@ import (
|
|||
|
||||
type NetIOInfo struct {
|
||||
Name string `json:"name"`
|
||||
RxBytes uint64 `json:"rx_bytes"`
|
||||
TxBytes uint64 `json:"tx_bytes"`
|
||||
RxKBytes int64 `json:"rx_kbytes"`
|
||||
TxKBytes int64 `json:"tx_kbytes"`
|
||||
}
|
||||
|
||||
type MemoryInfo struct {
|
||||
Total uint64 `json:"total_bytes"`
|
||||
Active uint64 `json:"active_bytes"`
|
||||
Cached uint64 `json:"cached_bytes"`
|
||||
Free uint64 `json:"free_bytes"`
|
||||
Inactive uint64 `json:"inactive_bytes"`
|
||||
SwapFree uint64 `json:"swap_free_bytes"`
|
||||
SwapTotal uint64 `json:"swap_total_bytes"`
|
||||
SwapUsed uint64 `json:"swap_used_bytes"`
|
||||
Used uint64 `json:"used_bytes"`
|
||||
Total int64 `json:"total_kbytes"`
|
||||
Active int64 `json:"active_kbytes"`
|
||||
Cached int64 `json:"cached_kbytes"`
|
||||
Free int64 `json:"free_kbytes"`
|
||||
Inactive int64 `json:"inactive_kbytes"`
|
||||
SwapFree int64 `json:"swap_free_kbytes"`
|
||||
SwapTotal int64 `json:"swap_total_kbytes"`
|
||||
SwapUsed int64 `json:"swap_used_kbytes"`
|
||||
Used int64 `json:"used_kbytes"`
|
||||
}
|
||||
|
||||
type LoadInfo struct {
|
||||
|
@ -118,8 +118,8 @@ func (p *OSMetricInfo) MarshalNetworks() (name string, tags []map[string]string,
|
|||
"name": name,
|
||||
}),
|
||||
append(fields, map[string]interface{}{
|
||||
"rx_bytes": info.RxBytes,
|
||||
"tx_bytes": info.TxBytes,
|
||||
"rx_kbytes": info.RxKBytes,
|
||||
"tx_kbytes": info.TxKBytes,
|
||||
})
|
||||
}
|
||||
return
|
||||
|
@ -135,15 +135,15 @@ func (p *OSMetricInfo) MarshalMemory() (name string, tags []map[string]string, f
|
|||
},
|
||||
[]map[string]interface{}{
|
||||
{
|
||||
"total_bytes": p.Memory.Total,
|
||||
"active_bytes": p.Memory.Active,
|
||||
"cached_bytes": p.Memory.Cached,
|
||||
"free_bytes": p.Memory.Free,
|
||||
"inactive_bytes": p.Memory.Inactive,
|
||||
"swap_free_bytes": p.Memory.SwapFree,
|
||||
"swap_total_bytes": p.Memory.SwapTotal,
|
||||
"swap_used_bytes": p.Memory.SwapUsed,
|
||||
"used_bytes": p.Memory.Used,
|
||||
"total_kbytes": p.Memory.Total,
|
||||
"active_kbytes": p.Memory.Active,
|
||||
"cached_kbytes": p.Memory.Cached,
|
||||
"free_kbytes": p.Memory.Free,
|
||||
"inactive_kbytes": p.Memory.Inactive,
|
||||
"swap_free_kbytes": p.Memory.SwapFree,
|
||||
"swap_total_kbytes": p.Memory.SwapTotal,
|
||||
"swap_used_kbytes": p.Memory.SwapUsed,
|
||||
"used_kbytes": p.Memory.Used,
|
||||
},
|
||||
}
|
||||
return
|
||||
|
@ -187,15 +187,15 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
|
|||
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
|
||||
info.Memory.Cached = memoryInfo.Cached
|
||||
info.Memory.Free = memoryInfo.Free
|
||||
info.Memory.Inactive = memoryInfo.Inactive
|
||||
info.Memory.SwapFree = memoryInfo.SwapFree
|
||||
info.Memory.SwapTotal = memoryInfo.SwapTotal
|
||||
info.Memory.SwapUsed = memoryInfo.SwapUsed
|
||||
info.Memory.Used = memoryInfo.Used
|
||||
info.Memory.Total = int64(memoryInfo.Total>>10)
|
||||
info.Memory.Active = int64(memoryInfo.Active>>10)
|
||||
info.Memory.Cached = int64(memoryInfo.Cached>>10)
|
||||
info.Memory.Free = int64(memoryInfo.Free>>10)
|
||||
info.Memory.Inactive = int64(memoryInfo.Inactive>>10)
|
||||
info.Memory.SwapFree = int64(memoryInfo.SwapFree>>10)
|
||||
info.Memory.SwapTotal = int64(memoryInfo.SwapTotal>>10)
|
||||
info.Memory.SwapUsed = int64(memoryInfo.SwapUsed>>10)
|
||||
info.Memory.Used = int64(memoryInfo.Used>>10)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -250,8 +250,8 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
|
|||
p.logger.Debug("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
|
||||
netIoMap[netio.Name] = NetIOInfo{
|
||||
Name: netio.Name,
|
||||
RxBytes: netio.RxBytes,
|
||||
TxBytes: netio.TxBytes,
|
||||
RxKBytes: int64(netio.RxBytes>>10),
|
||||
TxKBytes: int64(netio.TxBytes>>10),
|
||||
}
|
||||
}
|
||||
info.NetIO = netIoMap
|
||||
|
|
|
@ -18,28 +18,28 @@ import (
|
|||
|
||||
type NetIOInfo struct {
|
||||
Name string `json:"name"`
|
||||
RxBytes uint64 `json:"rx_bytes"`
|
||||
TxBytes uint64 `json:"tx_bytes"`
|
||||
RxKBytes int64 `json:"rx_kbytes"`
|
||||
TxKBytes int64 `json:"tx_kbytes"`
|
||||
}
|
||||
|
||||
type DiskIOInfo struct {
|
||||
Name string `json:"name"`
|
||||
ReadsCompletedBytes uint64 `json:"reads_completed_bytes"`
|
||||
WritesCompletedBytes uint64 `json:"writes_completed_bytes"`
|
||||
ReadsCompletedKBytes int64 `json:"reads_completed_kbytes"`
|
||||
WritesCompletedKBytes int64 `json:"writes_completed_kbytes"`
|
||||
}
|
||||
type MemoryInfo struct {
|
||||
Total uint64 `json:"total_bytes"`
|
||||
Available uint64 `json:"available_bytes"`
|
||||
Used uint64 `json:"used_bytes"`
|
||||
Buffers uint64 `json:"buffers_bytes"`
|
||||
Cached uint64 `json:"cached_bytes"`
|
||||
Free uint64 `json:"free_bytes"`
|
||||
Active uint64 `json:"active_bytes"`
|
||||
Inactive uint64 `json:"inactive_bytes"`
|
||||
SwapTotal uint64 `json:"swap_total_bytes"`
|
||||
SwapUsed uint64 `json:"swap_used_bytes"`
|
||||
SwapCached uint64 `json:"swap_cached_bytes"`
|
||||
SwapFree uint64 `json:"swap_free_bytes"`
|
||||
Total int64 `json:"total_kbytes"`
|
||||
Available int64 `json:"available_kbytes"`
|
||||
Used int64 `json:"used_kbytes"`
|
||||
Buffers int64 `json:"buffers_kbytes"`
|
||||
Cached int64 `json:"cached_kbytes"`
|
||||
Free int64 `json:"free_kbytes"`
|
||||
Active int64 `json:"active_kbytes"`
|
||||
Inactive int64 `json:"inactive_kbytes"`
|
||||
SwapTotal int64 `json:"swap_total_kbytes"`
|
||||
SwapUsed int64 `json:"swap_used_kbytes"`
|
||||
SwapCached int64 `json:"swap_cached_kbytes"`
|
||||
SwapFree int64 `json:"swap_free_kbytes"`
|
||||
}
|
||||
type LoadInfo struct {
|
||||
Avg1 float64 `json:"avg_1"`
|
||||
|
@ -136,8 +136,8 @@ func (p *OSMetricInfo) MarshalNetworks() (name string, tags []map[string]string,
|
|||
"name": name,
|
||||
}),
|
||||
append(fields, map[string]interface{}{
|
||||
"rx_bytes": info.RxBytes,
|
||||
"tx_bytes": info.TxBytes,
|
||||
"rx_kbytes": info.RxKBytes,
|
||||
"tx_kbytes": info.TxKBytes,
|
||||
})
|
||||
}
|
||||
return
|
||||
|
@ -154,8 +154,8 @@ func (p *OSMetricInfo) MarshalDisk() (name string, tags []map[string]string, fie
|
|||
"name": name,
|
||||
}),
|
||||
append(fields, map[string]interface{}{
|
||||
"reads_completed_bytes": info.ReadsCompletedBytes,
|
||||
"writes_completed_bytes": info.WritesCompletedBytes,
|
||||
"reads_completed_kbytes": info.ReadsCompletedKBytes,
|
||||
"writes_completed_kbytes": info.WritesCompletedKBytes,
|
||||
})
|
||||
}
|
||||
return
|
||||
|
@ -171,18 +171,18 @@ func (p *OSMetricInfo) MarshalMemory() (name string, tags []map[string]string, f
|
|||
},
|
||||
[]map[string]interface{}{
|
||||
{
|
||||
"total_bytes": p.Memory.Total,
|
||||
"used_bytes": p.Memory.Used,
|
||||
"available_bytes": p.Memory.Available,
|
||||
"buffers_bytes": p.Memory.Buffers,
|
||||
"cached_bytes": p.Memory.Cached,
|
||||
"free_bytes": p.Memory.Free,
|
||||
"active_bytes": p.Memory.Active,
|
||||
"inactive_bytes": p.Memory.Inactive,
|
||||
"swap_total_bytes": p.Memory.SwapTotal,
|
||||
"swap_used_bytes": p.Memory.SwapUsed,
|
||||
"swap_cached_bytes": p.Memory.SwapCached,
|
||||
"swap_free_bytes": p.Memory.SwapFree,
|
||||
"total_kbytes": p.Memory.Total,
|
||||
"used_kbytes": p.Memory.Used,
|
||||
"available_kbytes": p.Memory.Available,
|
||||
"buffers_kbytes": p.Memory.Buffers,
|
||||
"cached_kbytes": p.Memory.Cached,
|
||||
"free_kbytes": p.Memory.Free,
|
||||
"active_kbytes": p.Memory.Active,
|
||||
"inactive_kbytes": p.Memory.Inactive,
|
||||
"swap_total_kbytes": p.Memory.SwapTotal,
|
||||
"swap_used_kbytes": p.Memory.SwapUsed,
|
||||
"swap_cached_kbytes": p.Memory.SwapCached,
|
||||
"swap_free_kbytes": p.Memory.SwapFree,
|
||||
},
|
||||
}
|
||||
return
|
||||
|
@ -229,18 +229,18 @@ func (p *osMetric) readMemoryStat(info *OSMetricInfo, errChan chan<- error, wait
|
|||
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
|
||||
info.Memory.Available = memoryInfo.Available
|
||||
info.Memory.Buffers = memoryInfo.Buffers
|
||||
info.Memory.Cached = memoryInfo.Cached
|
||||
info.Memory.Free = memoryInfo.Free
|
||||
info.Memory.Active = memoryInfo.Active
|
||||
info.Memory.Inactive = memoryInfo.Inactive
|
||||
info.Memory.SwapTotal = memoryInfo.SwapTotal
|
||||
info.Memory.SwapUsed = memoryInfo.SwapUsed
|
||||
info.Memory.SwapCached = memoryInfo.SwapCached
|
||||
info.Memory.SwapFree = memoryInfo.SwapFree
|
||||
info.Memory.Total = int64(memoryInfo.Total>>10)
|
||||
info.Memory.Used = int64(memoryInfo.Used>>10)
|
||||
info.Memory.Available = int64(memoryInfo.Available>>10)
|
||||
info.Memory.Buffers = int64(memoryInfo.Buffers>>10)
|
||||
info.Memory.Cached = int64(memoryInfo.Cached>>10)
|
||||
info.Memory.Free = int64(memoryInfo.Free>>10)
|
||||
info.Memory.Active = int64(memoryInfo.Active>>10)
|
||||
info.Memory.Inactive = int64(memoryInfo.Inactive>>10)
|
||||
info.Memory.SwapTotal = int64(memoryInfo.SwapTotal>>10)
|
||||
info.Memory.SwapUsed = int64(memoryInfo.SwapUsed>>10)
|
||||
info.Memory.SwapCached = int64(memoryInfo.SwapCached>>10)
|
||||
info.Memory.SwapFree = int64(memoryInfo.SwapFree>>10)
|
||||
}
|
||||
|
||||
func (p *osMetric) readLoadStat(info *OSMetricInfo, errChan chan<- error, waiter *sync.WaitGroup) {
|
||||
|
@ -294,8 +294,8 @@ func (p *osMetric) readNetworkStat(info *OSMetricInfo, errChan chan<- error, wai
|
|||
p.logger.Debug("netio txBytes: ", misc.FileSizeIEC(netio.TxBytes))
|
||||
netIoMap[netio.Name] = NetIOInfo{
|
||||
Name: netio.Name,
|
||||
RxBytes: netio.RxBytes,
|
||||
TxBytes: netio.TxBytes,
|
||||
RxKBytes: int64(netio.RxBytes>>10),
|
||||
TxKBytes: int64(netio.TxBytes>>10),
|
||||
}
|
||||
}
|
||||
info.NetIO = netIoMap
|
||||
|
@ -396,8 +396,8 @@ func (p *osMetric) readDiskStat(info *OSMetricInfo, errChan chan<- error, waiter
|
|||
p.logger.Debug("disk written: ", misc.FileSizeIEC(dsk.WritesCompleted))
|
||||
diskIoMap[dsk.Name] = DiskIOInfo{
|
||||
Name: dsk.Name,
|
||||
ReadsCompletedBytes: dsk.ReadsCompleted,
|
||||
WritesCompletedBytes: dsk.WritesCompleted,
|
||||
ReadsCompletedKBytes: int64(dsk.ReadsCompleted>>10),
|
||||
WritesCompletedKBytes: int64(dsk.WritesCompleted>>10),
|
||||
}
|
||||
}
|
||||
info.DiskIO = diskIoMap
|
||||
|
|
Loading…
Reference in New Issue