Add support for gathering Slab memory usage

This is useful, for example when monitoring Slab memory leaks. To support
gathering this metric a minimum version of psutil 5.4.4 is required
(released on Apr 13th 2018).

Story: 2006815
Task: 37375
Change-Id: Ibe8def9e2a7c967a34236889aa03b287065abcdc
This commit is contained in:
Doug Szumski 2019-11-06 10:49:30 +00:00
parent 96afbc6b9c
commit 0a4abd532e
3 changed files with 11 additions and 0 deletions

View File

@ -459,6 +459,7 @@ instances:
| mem.used_cached | | Mbytes of memory used for the page cache
| mem.used_shared | | Mbytes of memory shared between separate processes and typically used for inter-process communication
| mem.used_real_mb | | Mbytes of memory currently in use less mem.used_buffers and mem.used_cached
| mem.used_slab_mb | | Mbytes of memory currently allocated to slab. Requires psutil >=5.4.4.
### Disk
| Metric Name | Dimensions | Semantics |

View File

@ -97,4 +97,11 @@ class Memory(checks.AgentCheck):
dimensions=dimensions)
count += 1
# The slab metric was added in psutil 5.4.4
if hasattr(mem_info, 'slab') and mem_info.slab:
self.gauge('mem.used_slab_mb',
int(mem_info.slab / 1048576),
dimensions=dimensions)
count += 1
log.debug('Collected {0} memory metrics'.format(count))

View File

@ -0,0 +1,3 @@
---
features:
- Adds support for monitoring slab memory usage.