Add hardware memory buffer and cache metrics

This patch aims to add two metrics to gather memory buffer and
memory cache information of a physical machine through SNMP
inspector.

Change-Id: Id9b953820a1e38c0f832405359a25015b6f20017
Implements: blueprint hardware-memory-buffer-and-cache-metrics
This commit is contained in:
Gangyi Luo 2015-04-27 19:11:45 -07:00 committed by Luo Gangyi
parent 9f76e5b580
commit 99211307c5
5 changed files with 36 additions and 0 deletions

View File

@ -68,6 +68,8 @@ class SNMPInspector(base.Inspector):
_memory_avail_real_oid = "1.3.6.1.4.1.2021.4.6.0" _memory_avail_real_oid = "1.3.6.1.4.1.2021.4.6.0"
_memory_total_swap_oid = "1.3.6.1.4.1.2021.4.3.0" _memory_total_swap_oid = "1.3.6.1.4.1.2021.4.3.0"
_memory_avail_swap_oid = "1.3.6.1.4.1.2021.4.4.0" _memory_avail_swap_oid = "1.3.6.1.4.1.2021.4.4.0"
_memory_buffer_oid = "1.3.6.1.4.1.2021.4.14.0"
_memory_cached_oid = "1.3.6.1.4.1.2021.4.15.0"
# Disk OIDs # Disk OIDs
_disk_index_oid = "1.3.6.1.4.1.2021.9.1.1" _disk_index_oid = "1.3.6.1.4.1.2021.9.1.1"
_disk_path_oid = "1.3.6.1.4.1.2021.9.1.2" _disk_path_oid = "1.3.6.1.4.1.2021.9.1.2"
@ -207,6 +209,18 @@ class SNMPInspector(base.Inspector):
'metadata': {}, 'metadata': {},
'post_op': None, 'post_op': None,
}, },
'memory.buffer': {
'matching_type': EXACT,
'metric_oid': (_memory_buffer_oid, int),
'metadata': {},
'post_op': None,
},
'memory.cached': {
'matching_type': EXACT,
'metric_oid': (_memory_cached_oid, int),
'metadata': {},
'post_op': None,
},
'disk.size.total': { 'disk.size.total': {
'matching_type': PREFIX, 'matching_type': PREFIX,
'metric_oid': (_disk_size_oid, int), 'metric_oid': (_disk_size_oid, int),

View File

@ -52,3 +52,11 @@ class MemorySwapTotalPollster(_Base):
class MemorySwapAvailPollster(_Base): class MemorySwapAvailPollster(_Base):
IDENTIFIER = 'memory.swap.avail' IDENTIFIER = 'memory.swap.avail'
class MemoryBufferPollster(_Base):
IDENTIFIER = 'memory.buffer'
class MemoryCachedPollster(_Base):
IDENTIFIER = 'memory.cached'

View File

@ -35,6 +35,8 @@ class FakeInspector(inspector_base.Inspector):
'cpu.load.15min': (0.55, {}, {}), 'cpu.load.15min': (0.55, {}, {}),
'memory.total': (1000, {}, {}), 'memory.total': (1000, {}, {}),
'memory.used': (90, {}, {}), 'memory.used': (90, {}, {}),
'memory.buffer': (500, {}, {}),
'memory.cached': (200, {}, {}),
'network.incoming.bytes': (90, net_metadata, {}), 'network.incoming.bytes': (90, net_metadata, {}),
'network.outgoing.bytes': (80, net_metadata, {}), 'network.outgoing.bytes': (80, net_metadata, {}),
'network.outgoing.errors': (1, net_metadata, {}), 'network.outgoing.errors': (1, net_metadata, {}),

View File

@ -30,3 +30,13 @@ class TestMemoryPollsters(base.TestPollsterBase):
self._check_get_samples(memory.MemoryUsedPollster, self._check_get_samples(memory.MemoryUsedPollster,
'hardware.memory.used', 'hardware.memory.used',
90, sample.TYPE_GAUGE) 90, sample.TYPE_GAUGE)
def test_memory_size_buffer(self):
self._check_get_samples(memory.MemoryBufferPollster,
'hardware.memory.buffer',
500, sample.TYPE_GAUGE)
def test_memory_size_cached(self):
self._check_get_samples(memory.MemoryCachedPollster,
'hardware.memory.cached',
200, sample.TYPE_GAUGE)

View File

@ -214,6 +214,8 @@ ceilometer.poll.central =
hardware.network.outgoing.errors = ceilometer.hardware.pollsters.net:OutgoingErrorsPollster hardware.network.outgoing.errors = ceilometer.hardware.pollsters.net:OutgoingErrorsPollster
hardware.memory.total = ceilometer.hardware.pollsters.memory:MemoryTotalPollster hardware.memory.total = ceilometer.hardware.pollsters.memory:MemoryTotalPollster
hardware.memory.used = ceilometer.hardware.pollsters.memory:MemoryUsedPollster hardware.memory.used = ceilometer.hardware.pollsters.memory:MemoryUsedPollster
hardware.memory.buffer = ceilometer.hardware.pollsters.memory:MemoryBufferPollster
hardware.memory.cached = ceilometer.hardware.pollsters.memory:MemoryCachedPollster
hardware.memory.swap.total = ceilometer.hardware.pollsters.memory:MemorySwapTotalPollster hardware.memory.swap.total = ceilometer.hardware.pollsters.memory:MemorySwapTotalPollster
hardware.memory.swap.avail = ceilometer.hardware.pollsters.memory:MemorySwapAvailPollster hardware.memory.swap.avail = ceilometer.hardware.pollsters.memory:MemorySwapAvailPollster
hardware.system_stats.cpu.idle = ceilometer.hardware.pollsters.system:SystemCpuIdlePollster hardware.system_stats.cpu.idle = ceilometer.hardware.pollsters.system:SystemCpuIdlePollster