More accurate meter name and unit for host load averages
Fixes bug 1307482 Previously, the SNMP reported load averages were misleadingly metered as percentage utilizations. Now, these samples include a meter name and unit that more accurately reflect their true meaning - i.e. an exponentially-damped moving average of the number of running or runnable processes. Change-Id: I5dbc6f7886ed9a451926b502365ec80322f6b458
This commit is contained in:
parent
0eb9f5131b
commit
5872c6fd12
@ -30,37 +30,37 @@ class _Base(plugin.HardwarePollster):
|
||||
INSPECT_METHOD = 'inspect_cpu'
|
||||
|
||||
|
||||
class CPUUtil1MinPollster(_Base):
|
||||
class CPULoad1MinPollster(_Base):
|
||||
|
||||
@staticmethod
|
||||
def generate_one_sample(host, c_data):
|
||||
return util.make_sample_from_host(host,
|
||||
name='cpu.util.1min',
|
||||
name='cpu.load.1min',
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='%',
|
||||
unit='process',
|
||||
volume=c_data.cpu_1_min,
|
||||
)
|
||||
|
||||
|
||||
class CPUUtil5MinPollster(_Base):
|
||||
class CPULoad5MinPollster(_Base):
|
||||
|
||||
@staticmethod
|
||||
def generate_one_sample(host, c_data):
|
||||
return util.make_sample_from_host(host,
|
||||
name='cpu.util.5min',
|
||||
name='cpu.load.5min',
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='%',
|
||||
unit='process',
|
||||
volume=c_data.cpu_5_min,
|
||||
)
|
||||
|
||||
|
||||
class CPUUtil15MinPollster(_Base):
|
||||
class CPULoad15MinPollster(_Base):
|
||||
|
||||
@staticmethod
|
||||
def generate_one_sample(host, c_data):
|
||||
return util.make_sample_from_host(host,
|
||||
name='cpu.util.15min',
|
||||
name='cpu.load.15min',
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='%',
|
||||
unit='process',
|
||||
volume=c_data.cpu_15_min,
|
||||
)
|
||||
|
@ -65,7 +65,7 @@ class TestPollsterBase(test_base.BaseTestCase):
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def _check_get_samples(self, factory, name,
|
||||
expected_value, expected_type):
|
||||
expected_value, expected_type, expected_unit=None):
|
||||
mgr = manager.AgentManager()
|
||||
pollster = factory()
|
||||
cache = {}
|
||||
@ -80,3 +80,5 @@ class TestPollsterBase(test_base.BaseTestCase):
|
||||
match = [s for s in samples if s.name == name]
|
||||
self.assertEqual(expected_value, match[0].volume)
|
||||
self.assertEqual(expected_type, match[0].type)
|
||||
if expected_unit:
|
||||
self.assertEqual(expected_unit, match[0].unit)
|
||||
|
@ -23,16 +23,19 @@ from ceilometer.tests.hardware.pollsters import base
|
||||
|
||||
class TestCPUPollsters(base.TestPollsterBase):
|
||||
def test_1min(self):
|
||||
self._check_get_samples(cpu.CPUUtil1MinPollster,
|
||||
'hardware.cpu.util.1min',
|
||||
0.99, sample.TYPE_GAUGE)
|
||||
self._check_get_samples(cpu.CPULoad1MinPollster,
|
||||
'hardware.cpu.load.1min',
|
||||
0.99, sample.TYPE_GAUGE,
|
||||
expected_unit='process')
|
||||
|
||||
def test_5min(self):
|
||||
self._check_get_samples(cpu.CPUUtil5MinPollster,
|
||||
'hardware.cpu.util.5min',
|
||||
0.77, sample.TYPE_GAUGE)
|
||||
self._check_get_samples(cpu.CPULoad5MinPollster,
|
||||
'hardware.cpu.load.5min',
|
||||
0.77, sample.TYPE_GAUGE,
|
||||
expected_unit='process')
|
||||
|
||||
def test_15min(self):
|
||||
self._check_get_samples(cpu.CPUUtil15MinPollster,
|
||||
'hardware.cpu.util.15min',
|
||||
0.55, sample.TYPE_GAUGE)
|
||||
self._check_get_samples(cpu.CPULoad15MinPollster,
|
||||
'hardware.cpu.load.15min',
|
||||
0.55, sample.TYPE_GAUGE,
|
||||
expected_unit='process')
|
||||
|
@ -122,9 +122,9 @@ ceilometer.poll.central =
|
||||
switch.flow.duration.nanoseconds = ceilometer.network.statistics.flow:FlowPollsterDurationNanoseconds
|
||||
switch.flow.duration.seconds = ceilometer.network.statistics.flow:FlowPollsterDurationSeconds
|
||||
switch.flow.packets = ceilometer.network.statistics.flow:FlowPollsterPackets
|
||||
hardware.cpu.util.1min = ceilometer.hardware.pollsters.cpu:CPUUtil1MinPollster
|
||||
hardware.cpu.util.5min = ceilometer.hardware.pollsters.cpu:CPUUtil5MinPollster
|
||||
hardware.cpu.util.15min = ceilometer.hardware.pollsters.cpu:CPUUtil15MinPollster
|
||||
hardware.cpu.load.1min = ceilometer.hardware.pollsters.cpu:CPULoad1MinPollster
|
||||
hardware.cpu.load.5min = ceilometer.hardware.pollsters.cpu:CPULoad5MinPollster
|
||||
hardware.cpu.load.15min = ceilometer.hardware.pollsters.cpu:CPULoad15MinPollster
|
||||
hardware.disk.size.total = ceilometer.hardware.pollsters.disk:DiskTotalPollster
|
||||
hardware.disk.size.used = ceilometer.hardware.pollsters.disk:DiskUsedPollster
|
||||
hardware.network.bandwidth.bytes = ceilometer.hardware.pollsters.net:BandwidthBytesPollster
|
||||
|
Loading…
Reference in New Issue
Block a user