diff --git a/ceilometer/hardware/pollsters/cpu.py b/ceilometer/hardware/pollsters/cpu.py index 5505eb8ec..2d3b00c54 100644 --- a/ceilometer/hardware/pollsters/cpu.py +++ b/ceilometer/hardware/pollsters/cpu.py @@ -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, ) diff --git a/ceilometer/tests/hardware/pollsters/base.py b/ceilometer/tests/hardware/pollsters/base.py index 99fab0305..d1412e4c6 100644 --- a/ceilometer/tests/hardware/pollsters/base.py +++ b/ceilometer/tests/hardware/pollsters/base.py @@ -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) diff --git a/ceilometer/tests/hardware/pollsters/test_cpu.py b/ceilometer/tests/hardware/pollsters/test_cpu.py index 0f13638d0..63aa7184b 100644 --- a/ceilometer/tests/hardware/pollsters/test_cpu.py +++ b/ceilometer/tests/hardware/pollsters/test_cpu.py @@ -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') diff --git a/setup.cfg b/setup.cfg index ef67325b4..d89dc1e90 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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