parent
10d411c4f7
commit
1cd2db9f8c
|
@ -7,17 +7,18 @@ explanation of the difference between `used` and `actual_used` RAM, see
|
|||
[Linux ate my ram](http://www.linuxatemyram.com/).
|
||||
|
||||
- **total**: total physical memory available
|
||||
- **actual_free**: the actual amount of available memory that can be given instantly
|
||||
to processes that request more memory in bytes; this is calculated by summing
|
||||
different memory values depending on the platform (e.g. free + buffers + cached on Linux)
|
||||
and it is supposed to be used to monitor actual memory usage in a cross platform fashion.
|
||||
- **actual_used**: inverse of actual_free, see above
|
||||
- **actual_used_percent**: the percentage usage calculated as (total - actual_used) / total * 100
|
||||
- **available**: the actual amount of available memory that can be given instantly
|
||||
to processes that request more memory in bytes; In linux kernel 3.14+, this
|
||||
is available natively in /proc/meminfo. In other platforms, this is calculated by
|
||||
summing different memory values depending on the platform
|
||||
(e.g. free + buffers + cached on Linux).
|
||||
It is supposed to be used to monitor actual memory usage in a cross platform fashion.
|
||||
- **available_percent**: Percent of memory available, `available / total * 100`
|
||||
- **used**: memory used, calculated differently depending on the platform and
|
||||
designed for informational purposes only.
|
||||
- **free**: memory not being used at all (zeroed) that is readily available; note
|
||||
that this doesn't reflect the actual memory available (use 'available' instead).
|
||||
- **used_percent**: the percentage usage calculated as (total - used) / total * 100
|
||||
- **used_percent**: the percentage usage calculated as `(total - used) / total * 100`
|
||||
|
||||
## Measurements:
|
||||
#### Raw Memory measurements:
|
||||
|
@ -28,8 +29,7 @@ Meta:
|
|||
|
||||
Measurement names:
|
||||
- mem_total
|
||||
- mem_actual_free
|
||||
- mem_actual_used
|
||||
- mem_available
|
||||
- mem_used
|
||||
- mem_free
|
||||
|
||||
|
@ -41,4 +41,4 @@ Meta:
|
|||
|
||||
Measurement names:
|
||||
- mem_used_percent
|
||||
- mem_actual_used_percent
|
||||
- mem_available_percent
|
||||
|
|
|
@ -25,13 +25,12 @@ func (s *MemStats) Gather(acc plugins.Accumulator) error {
|
|||
vmtags := map[string]string(nil)
|
||||
|
||||
acc.Add("total", vm.Total, vmtags)
|
||||
acc.Add("actual_free", vm.Available, vmtags)
|
||||
acc.Add("actual_used", vm.Total-vm.Available, vmtags)
|
||||
acc.Add("available", vm.Available, vmtags)
|
||||
acc.Add("used", vm.Used, vmtags)
|
||||
acc.Add("free", vm.Free, vmtags)
|
||||
acc.Add("used_percent", 100*float64(vm.Used)/float64(vm.Total), vmtags)
|
||||
acc.Add("actual_used_percent",
|
||||
100*float64(vm.Total-vm.Available)/float64(vm.Total),
|
||||
acc.Add("available_percent",
|
||||
100*float64(vm.Available)/float64(vm.Total),
|
||||
vmtags)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -230,11 +230,10 @@ func TestSystemStats_GenerateStats(t *testing.T) {
|
|||
vmtags := map[string]string(nil)
|
||||
|
||||
assert.True(t, acc.CheckTaggedValue("total", uint64(12400), vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("actual_free", uint64(7600), vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("actual_used", uint64(12400-7600), vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("available", uint64(7600), vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("used", uint64(5000), vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("actual_used_percent",
|
||||
float64(12400-7600)/float64(12400)*100,
|
||||
assert.True(t, acc.CheckTaggedValue("available_percent",
|
||||
float64(7600)/float64(12400)*100,
|
||||
vmtags))
|
||||
assert.True(t, acc.CheckTaggedValue("used_percent",
|
||||
float64(5000)/float64(12400)*100,
|
||||
|
|
Loading…
Reference in New Issue