diff --git a/ceilometer/image/notifications.py b/ceilometer/image/notifications.py index b91bd5a32..baa46cb94 100644 --- a/ceilometer/image/notifications.py +++ b/ceilometer/image/notifications.py @@ -89,7 +89,7 @@ class ImageCRUD(ImageCRUDBase): counter.Counter( name=message['event_type'], type=counter.TYPE_DELTA, - unit='event', + unit='image', volume=1, resource_id=message['payload']['id'], user_id=None, diff --git a/ceilometer/network/notifications.py b/ceilometer/network/notifications.py index ac3cdc539..0a8892050 100644 --- a/ceilometer/network/notifications.py +++ b/ceilometer/network/notifications.py @@ -70,11 +70,12 @@ class NetworkNotificationBase(plugin.NotificationBase): LOG.info('network notification %r', message) message['payload'] = message['payload'][self.resource_name] metadata = self.notification_to_metadata(message) - counter_name = getattr(self, "counter_name", self.resource_name) + counter_name = getattr(self, 'counter_name', self.resource_name) + unit_value = getattr(self, 'unit', self.resource_name) yield counter.Counter(name=counter_name, type=counter.TYPE_GAUGE, - unit=self.resource_name, + unit=unit_value, volume=1, user_id=message['_context_user_id'], project_id=message['payload']['tenant_id'], @@ -88,7 +89,7 @@ class NetworkNotificationBase(plugin.NotificationBase): yield counter.Counter(name=counter_name + "." + event_type_split[1], type=counter.TYPE_DELTA, - unit=self.resource_name, + unit=unit_value, volume=1, user_id=message['_context_user_id'], project_id=message['payload']['tenant_id'], @@ -189,3 +190,4 @@ class FloatingIP(NetworkNotificationBase): resource_name = 'floatingip' counter_name = 'ip.floating' + unit = 'ip' diff --git a/ceilometer/volume/notifications.py b/ceilometer/volume/notifications.py index b58a81e3b..b5ccdcffe 100644 --- a/ceilometer/volume/notifications.py +++ b/ceilometer/volume/notifications.py @@ -88,7 +88,7 @@ class VolumeSize(_Base): return [ counter.Counter(name='volume.size', type=counter.TYPE_GAUGE, - unit='B', + unit='GB', volume=message['payload']['size'], user_id=message['payload']['user_id'], project_id=message['payload']['tenant_id'],