Fix network.bw.* qty matching the unit by gnocchi collector

network.bw.* unit is MB, but actually is B. So make the qty matching
the unit to MB, when collector is gnocchi.

Change-Id: I44ee4eb9f1b3dc0d7d5f90a86b8c574a085e29e0
Closes-Bug: #1620199
This commit is contained in:
zhangguoqing
2016-09-05 15:25:47 +08:00
parent 65df026b15
commit 4d4114249f
2 changed files with 3 additions and 1 deletions

View File

@@ -261,7 +261,7 @@ class CeilometerCollector(collector.BaseCollector):
tap)
tap = self._cacher.get_resource_detail('network.tap',
tap_id)
tap_bw_mb = tap_stat.max / 1048576.0
tap_bw_mb = tap_stat.max / 1000000.0
bw_data.append(self.t_cloudkitty.format_item(tap,
'MB',
tap_bw_mb))

View File

@@ -273,6 +273,8 @@ class GnocchiCollector(collector.BaseCollector):
start,
end)
resource_data.pop('metrics', None)
if resource_data.get('type') == 'instance_network_interface':
resource_data[qty] = resource_data[qty] / 1000000.0
data = self.t_cloudkitty.format_item(
resource_data,
unit,