Fixed memory reporting for Linux systems
/proc/meminfo reports memory in KiloBytes and so needs a multiplier of 1024 instead of 1000. The kernel reports in terms of pages and the proc filesystem is left shifting by 2 for 4KB pages to get KB. Since this is a binary shift, Bytes will need to shift by 10 and so get multiplied by 1024. From the kernel code. PAGE_SHIFT = 12 for 4KB pages "MemTotal: %8lu kB\n", K(i.totalram) Closes #131
This commit is contained in:
parent
ca1d2c7000
commit
8d034f544c
|
@ -9,6 +9,7 @@
|
|||
### Bugfixes
|
||||
- [#128](https://github.com/influxdb/telegraf/issues/128): system_load measurement missing.
|
||||
- [#129](https://github.com/influxdb/telegraf/issues/129): Latest pkg url fix.
|
||||
- [#131](https://github.com/influxdb/telegraf/issues/131): Fix memory reporting on linux & darwin. Thanks @subhachandrachandra!
|
||||
- [#140](https://github.com/influxdb/telegraf/issues/140): Memory plugin prec->perc typo fix. Thanks @brunoqc!
|
||||
|
||||
## v0.1.6 [2015-08-20]
|
||||
|
|
|
@ -30,17 +30,17 @@ func VirtualMemory() (*VirtualMemoryStat, error) {
|
|||
}
|
||||
switch key {
|
||||
case "MemTotal":
|
||||
ret.Total = t * 1000
|
||||
ret.Total = t * 1024
|
||||
case "MemFree":
|
||||
ret.Free = t * 1000
|
||||
ret.Free = t * 1024
|
||||
case "Buffers":
|
||||
ret.Buffers = t * 1000
|
||||
ret.Buffers = t * 1024
|
||||
case "Cached":
|
||||
ret.Cached = t * 1000
|
||||
ret.Cached = t * 1024
|
||||
case "Active":
|
||||
ret.Active = t * 1000
|
||||
ret.Active = t * 1024
|
||||
case "Inactive":
|
||||
ret.Inactive = t * 1000
|
||||
ret.Inactive = t * 1024
|
||||
}
|
||||
}
|
||||
ret.Available = ret.Free + ret.Buffers + ret.Cached
|
||||
|
|
Loading…
Reference in New Issue