Example #1
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_('checking cache usage for instance %s'), instance.id)
         try:
             cpu_cache = self.inspector.inspect_cpu_l3_cache(instance)
             LOG.debug(_("CPU cache size: %(id)s %(cache_size)d"),
                       ({'id': instance.id,
                         'cache_size': cpu_cache.l3_cache_usage}))
             yield util.make_sample_from_instance(
                 self.conf,
                 instance,
                 name='cpu_l3_cache',
                 type=sample.TYPE_GAUGE,
                 unit='B',
                 volume=cpu_cache.l3_cache_usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except virt_inspector.NoDataException as e:
             LOG.warning(('Cannot inspect data of %(pollster)s for '
                          '%(instance_id)s, non-fatal reason: %(exc)s'),
                         {'pollster': self.__class__.__name__,
                          'instance_id': instance.id, 'exc': e})
             raise plugin_base.PollsterPermanentError(resources)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining cache usage is not implemented for %s',
                       self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(_('Could not get cache usage for %(id)s: %(e)s'),
                           {'id': instance.id, 'e': err})
Example #2
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_('checking cache usage for instance %s'), instance.id)
         try:
             cpu_cache = self.inspector.inspect_cpu_l3_cache(instance)
             LOG.debug(_("CPU cache size: %(id)s %(cache_size)d"),
                       ({'id': instance.id,
                         'l3_cache_usage': cpu_cache.l3_cache_usage}))
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu_l3_cache',
                 type=sample.TYPE_GAUGE,
                 unit='B',
                 volume=cpu_cache.l3_cache_usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except virt_inspector.NoDataException as e:
             LOG.warning(('Cannot inspect data of %(pollster)s for '
                          '%(instance_id)s, non-fatal reason: %(exc)s'),
                         {'pollster': self.__class__.__name__,
                          'instance_id': instance.id, 'exc': e})
             raise plugin_base.PollsterPermanentError(resources)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining cache usage is not implemented for %s',
                       self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(_('Could not get cache usage for %(id)s: %(e)s'),
                           {'id': instance.id, 'e': err})
Example #3
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.info(_('checking instance %s'), instance.id)
         instance_name = util.instance_name(instance)
         try:
             cpu_info = manager.inspector.inspect_cpus(instance_name)
             LOG.info(_("CPUTIME USAGE: %(instance)s %(time)d") % (
                      {'instance': instance.__dict__,
                       'time': cpu_info.time}))
             cpu_num = {'cpu_number': cpu_info.number}
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu',
                 type=sample.TYPE_CUMULATIVE,
                 unit='ns',
                 volume=cpu_info.time,
                 additional_metadata=cpu_num,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining CPU time is not implemented for %s'
                         ), manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.error(_('could not get CPU time for %(id)s: %(e)s') % (
                       {'id': instance.id, 'e': err}))
             LOG.exception(err)
Example #4
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_("checking cache usage for instance %s"), instance.id)
         try:
             cpu_cache = self.inspector.inspect_cpu_l3_cache(instance)
             LOG.debug(
                 _("CPU cache size: %(id)s %(cache_size)d"),
                 ({"id": instance.id, "cache_size": cpu_cache.l3_cache_usage}),
             )
             yield util.make_sample_from_instance(
                 self.conf,
                 instance,
                 name="cpu_l3_cache",
                 type=sample.TYPE_GAUGE,
                 unit="B",
                 volume=cpu_cache.l3_cache_usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug("Exception while getting samples %s", err)
         except virt_inspector.NoDataException as e:
             LOG.warning(
                 ("Cannot inspect data of %(pollster)s for " "%(instance_id)s, non-fatal reason: %(exc)s"),
                 {"pollster": self.__class__.__name__, "instance_id": instance.id, "exc": e},
             )
             raise plugin_base.PollsterPermanentError(resources)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug("Obtaining cache usage is not implemented for %s", self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(_("Could not get cache usage for %(id)s: %(e)s"), {"id": instance.id, "e": err})
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug('Checking resident memory for instance %s',
                   instance.id)
         instance_name = util.instance_name(instance)
         try:
             memory_info = manager.inspector.inspect_memory_resident(
                 instance_name, self._inspection_duration)
             LOG.debug("RESIDENT MEMORY: %(instance)s %(resident)f",
                       {'instance': instance,
                        'resident': memory_info.resident})
             yield util.make_sample_from_instance(
                 instance,
                 name='memory.resident',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=memory_info.resident,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining Resident Memory is not implemented'
                       ' for %s', self.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(_('Could not get Resident Memory Usage for '
                               '%(id)s: %(e)s'), {'id': instance.id,
                                                  'e': err})
Example #6
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug('checking instance %s', instance.id)
         try:
             cpu_info = self.inspector.inspect_cpus(instance)
             LOG.debug("CPUTIME USAGE: %(instance)s %(time)d",
                       {'instance': instance,
                        'time': cpu_info.time})
             cpu_num = {'cpu_number': cpu_info.number}
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu',
                 type=sample.TYPE_CUMULATIVE,
                 unit='ns',
                 volume=cpu_info.time,
                 additional_metadata=cpu_num,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except virt_inspector.InstanceShutOffException as e:
             LOG.debug('Instance %(instance_id)s was shut off while '
                       'getting samples of %(pollster)s: %(exc)s',
                       {'instance_id': instance.id,
                        'pollster': self.__class__.__name__, 'exc': e})
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining CPU time is not implemented for %s',
                       self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(_('could not get CPU time for %(id)s: %(e)s'),
                           {'id': instance.id, 'e': err})
Example #7
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug(_('Checking memory usage for instance %s'), instance.id)
         try:
             memory_info = manager.inspector.inspect_memory_usage(
                 instance, self._inspection_duration)
             LOG.debug(_("MEMORY USAGE: %(instance)s %(usage)f"),
                       ({'instance': instance.__dict__,
                         'usage': memory_info.usage}))
             yield util.make_sample_from_instance(
                 instance,
                 name='memory.usage',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=memory_info.usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining Memory Usage is not implemented for %s'
                         ), manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.error(_('Could not get Memory Usage for %(id)s: %(e)s'), (
                       {'id': instance.id, 'e': err}))
Example #8
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_('checking instance %s'), instance.id)
         instance_name = util.instance_name(instance)
         try:
             checkpoint_pause = manager.inspector.inspect_checkpoint(
                 instance)[2]
             LOG.debug(_("CHECKPOINT PAUSE: %(instance)s %(time)d"), {
                 'instance': instance.__dict__,
                 'time': checkpoint_pause
             })
             yield util.make_sample_from_instance(
                 instance,
                 name='checkpoint.pause',
                 type=sample.TYPE_GAUGE,
                 unit='ms',
                 volume=checkpoint_pause,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(
                 _('Obtaining checkpoint pause is not implemented for %s'),
                 manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(
                 _('could not get checkpoint pause for %(id)s: %(e)s'), {
                     'id': instance.id,
                     'e': err
                 })
Example #9
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_("checking instance %s"), instance.id)
         try:
             cpu_info = self.inspector.inspect_cpus(instance)
             LOG.debug(
                 _("CPUTIME USAGE: %(instance)s %(time)d"), {"instance": instance.__dict__, "time": cpu_info.time}
             )
             cpu_num = {"cpu_number": cpu_info.number}
             yield util.make_sample_from_instance(
                 instance,
                 name="cpu",
                 type=sample.TYPE_CUMULATIVE,
                 unit="ns",
                 volume=cpu_info.time,
                 additional_metadata=cpu_num,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_("Exception while getting samples %s"), err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_("Obtaining CPU time is not implemented for %s"), self.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(_("could not get CPU time for %(id)s: %(e)s"), {"id": instance.id, "e": err})
Example #10
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_('Checking CPU util for instance %s'), instance.id)
         try:
             cpu_info = manager.inspector.inspect_cpu_util(instance)
             LOG.debug(_("CPU UTIL: %(instance)s %(util)d"),
                       ({'instance': instance.__dict__,
                         'util': cpu_info.util}))
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu_util',
                 type=sample.TYPE_GAUGE,
                 unit='%',
                 volume=cpu_info.util,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining CPU Util is not implemented for %s'
                         ), manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.error(_('Could not get CPU Util for %(id)s: %(e)s'), (
                       {'id': instance.id, 'e': err}))
Example #11
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug(_('Checking CPU util for instance %s'), instance.id)
         try:
             cpu_info = self.inspector.inspect_cpu_util(
                 instance, self._inspection_duration)
             LOG.debug(_("CPU UTIL: %(instance)s %(util)d"),
                       ({
                           'instance': instance.__dict__,
                           'util': cpu_info.util
                       }))
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu_util',
                 type=sample.TYPE_GAUGE,
                 unit='%',
                 volume=cpu_info.util,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining CPU Util is not implemented for %s'),
                       self.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(_('Could not get CPU Util for %(id)s: %(e)s'), {
                 'id': instance.id,
                 'e': err
             })
Example #12
0
 def get_samples(self, manager, cache, resources):
     for instance in resources:
         LOG.debug(_('checking instance %s'), instance.id)
         try:
             cpu_info = self.inspector.inspect_cpus(instance)
             LOG.debug(_("CPUTIME USAGE: %(instance)s %(time)d"), {
                 'instance': instance.__dict__,
                 'time': cpu_info.time
             })
             cpu_num = {'cpu_number': cpu_info.number}
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu',
                 type=sample.TYPE_CUMULATIVE,
                 unit='ns',
                 volume=cpu_info.time,
                 additional_metadata=cpu_num,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining CPU time is not implemented for %s'),
                       self.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(_('could not get CPU time for %(id)s: %(e)s'), {
                 'id': instance.id,
                 'e': err
             })
Example #13
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug('Checking CPU util for instance %s', instance.id)
         try:
             cpu_info = self.inspector.inspect_cpu_util(
                 instance, self._inspection_duration)
             LOG.debug("CPU UTIL: %(instance)s %(util)d",
                       {'instance': instance,
                        'util': cpu_info.util})
             yield util.make_sample_from_instance(
                 instance,
                 name='cpu_util',
                 type=sample.TYPE_GAUGE,
                 unit='%',
                 volume=cpu_info.util,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining CPU Util is not implemented for %s',
                       self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(_('Could not get CPU Util for %(id)s: %(e)s'),
                           {'id': instance.id, 'e': err})
Example #14
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug(_('Checking memory usage for instance %s'), instance.id)
         try:
             instance_name = util.instance_name(instance)
             memory_info = manager.inspector.inspect_memory_usage( instance_name, self._inspection_duration)
             if (memory_info):
                 usg=memory_info.usage
             else:
                 usg=0;
             # Workaround https://bugs.launchpad.net/fuel/+bug/1379794
             LOG.debug(_("MEMORY USAGE: %(instance)s %(usage)f"),
                       ({'instance': getattr(instance, 'id'),
                         'usage': usg}))
             yield util.make_sample_from_instance(
                 instance,
                 name='memory.usage',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=usg,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(_('Obtaining Memory Usage is not implemented for %s'
                         ), manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(_('Could not get Memory Usage for '
                             '%(id)s: %(e)s'), {'id': instance.id,
                                                'e': err})
Example #15
0
 def get_samples(self, manager, cache, instance):
     LOG.info(_('checking instance %s'), instance.id)
     instance_name = util.instance_name(instance)
     try:
         cpu_info = manager.inspector.inspect_cpus(instance_name)
         LOG.info(
             _("CPUTIME USAGE: %(instance)s %(time)d") %
             ({
                 'instance': instance.__dict__,
                 'time': cpu_info.time
             }))
         cpu_num = {'cpu_number': cpu_info.number}
         yield util.make_sample_from_instance(
             instance,
             name='cpu',
             type=sample.TYPE_CUMULATIVE,
             unit='ns',
             volume=cpu_info.time,
             additional_metadata=cpu_num,
         )
     except virt_inspector.InstanceNotFoundException as err:
         # Instance was deleted while getting samples. Ignore it.
         LOG.debug(_('Exception while getting samples %s'), err)
     except Exception as err:
         LOG.error(
             _('could not get CPU time for %(id)s: %(e)s') %
             ({
                 'id': instance.id,
                 'e': err
             }))
         LOG.exception(err)
Example #16
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug('Checking resident memory for instance %s', instance.id)
         instance_name = util.instance_name(instance)
         try:
             memory_info = manager.inspector.inspect_memory_resident(
                 instance_name, self._inspection_duration)
             LOG.debug("RESIDENT MEMORY: %(instance)s %(resident)f", {
                 'instance': instance,
                 'resident': memory_info.resident
             })
             yield util.make_sample_from_instance(
                 instance,
                 name='memory.resident',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=memory_info.resident,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(
                 'Obtaining Resident Memory is not implemented'
                 ' for %s', self.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(
                 _('Could not get Resident Memory Usage for '
                   '%(id)s: %(e)s'), {
                       'id': instance.id,
                       'e': err
                   })
Example #17
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug(_('Checking memory usage for instance %s'), instance.id)
         try:
             memory_info = manager.inspector.inspect_memory_usage(
                 instance, self._inspection_duration)
             LOG.debug(_("MEMORY USAGE: %(instance)s %(usage)f"),
                       ({
                           'instance': instance.__dict__,
                           'usage': memory_info.usage
                       }))
             yield util.make_sample_from_instance(
                 instance,
                 name='memory.usage',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=memory_info.usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug(_('Exception while getting samples %s'), err)
         except NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug(
                 _('Obtaining Memory Usage is not implemented for %s'),
                 manager.inspector.__class__.__name__)
         except Exception as err:
             LOG.exception(
                 _('Could not get Memory Usage for '
                   '%(id)s: %(e)s'), {
                       'id': instance.id,
                       'e': err
                   })
Example #18
0
 def get_samples(self, manager, cache, resources):
     self._inspection_duration = self._record_poll_time()
     for instance in resources:
         LOG.debug('Checking memory usage for instance %s', instance.id)
         try:
             memory_info = self.inspector.inspect_memory_usage(
                 instance, self._inspection_duration)
             LOG.debug("MEMORY USAGE: %(instance)s %(usage)f", {
                 'instance': instance,
                 'usage': memory_info.usage
             })
             yield util.make_sample_from_instance(
                 self.conf,
                 instance,
                 name='memory.usage',
                 type=sample.TYPE_GAUGE,
                 unit='MB',
                 volume=memory_info.usage,
             )
         except virt_inspector.InstanceNotFoundException as err:
             # Instance was deleted while getting samples. Ignore it.
             LOG.debug('Exception while getting samples %s', err)
         except virt_inspector.InstanceShutOffException as e:
             LOG.debug(
                 'Instance %(instance_id)s was shut off while '
                 'getting samples of %(pollster)s: %(exc)s', {
                     'instance_id': instance.id,
                     'pollster': self.__class__.__name__,
                     'exc': e
                 })
         except virt_inspector.InstanceNoDataException as e:
             LOG.warning(
                 _LW('Cannot inspect data of %(pollster)s for '
                     '%(instance_id)s, non-fatal reason: %(exc)s'), {
                         'pollster': self.__class__.__name__,
                         'instance_id': instance.id,
                         'exc': e
                     })
         except virt_inspector.NoDataException as e:
             LOG.warning(
                 _LW('Cannot inspect data of %(pollster)s for '
                     '%(instance_id)s: %(exc)s'), {
                         'pollster': self.__class__.__name__,
                         'instance_id': instance.id,
                         'exc': e
                     })
             raise plugin_base.PollsterPermanentError(resources)
         except ceilometer.NotImplementedError:
             # Selected inspector does not implement this pollster.
             LOG.debug('Obtaining Memory Usage is not implemented for %s',
                       self.inspector.__class__.__name__)
             raise plugin_base.PollsterPermanentError(resources)
         except Exception as err:
             LOG.exception(
                 _LE('Could not get Memory Usage for '
                     '%(id)s: %(e)s'), {
                         'id': instance.id,
                         'e': err
                     })
Example #19
0
 def get_samples(manager, cache, instance):
     yield util.make_sample_from_instance(
         instance,
         name='instance',
         type=sample.TYPE_GAUGE,
         unit='instance',
         volume=1,
     )
Example #20
0
 def get_samples(manager, cache, instance):
     yield util.make_sample_from_instance(
         instance,
         name='instance',
         type=sample.TYPE_GAUGE,
         unit='instance',
         volume=1,
     )
Example #21
0
 def _get_sample(self, instance, disk_rates_info):
     return util.make_sample_from_instance(
         instance,
         name='disk.read.bytes.rate',
         type=sample.TYPE_GAUGE,
         unit='B/s',
         volume=disk_rates_info.read_bytes_rate,
     )
Example #22
0
 def _get_sample(self, instance, disk_rates_info):
     return util.make_sample_from_instance(
         instance,
         name='disk.write.requests.rate',
         type=sample.TYPE_GAUGE,
         unit='requests/s',
         volume=disk_rates_info.write_requests_rate,
     )
Example #23
0
 def _get_sample(instance, c_data):
     return util.make_sample_from_instance(
         instance,
         name='disk.read.requests',
         type=sample.TYPE_CUMULATIVE,
         unit='request',
         volume=c_data.r_requests,
     )
 def _get_samples(self, instance, disk_latency_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.latency',
         type=sample.TYPE_GAUGE,
         unit='ms',
         volume=disk_latency_info.disk_latency / 1000
     )]
Example #25
0
 def _get_sample(instance, c_data):
     return util.make_sample_from_instance(
         instance,
         name='disk.write.bytes',
         type=sample.TYPE_CUMULATIVE,
         unit='B',
         volume=c_data.w_bytes,
     )
 def _get_samples(self, instance, disk_iops_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.iops',
         type=sample.TYPE_GAUGE,
         unit='count/s',
         volume=disk_iops_info.iops_count
     )]
Example #27
0
 def _get_samples(self, instance, disk_iops_info):
     return [
         util.make_sample_from_instance(instance,
                                        name='disk.iops',
                                        type=sample.TYPE_GAUGE,
                                        unit='count/s',
                                        volume=disk_iops_info.iops_count)
     ]
Example #28
0
 def _get_sample(instance, c_data):
     return util.make_sample_from_instance(
         instance,
         name='disk.read.requests',
         type=sample.TYPE_CUMULATIVE,
         unit='request',
         volume=c_data.r_requests,
     )
Example #29
0
 def _get_sample(self, instance, disk_rates_info):
     return util.make_sample_from_instance(
         instance,
         name='disk.write.requests.rate',
         type=sample.TYPE_GAUGE,
         unit='requests/s',
         volume=disk_rates_info.write_requests_rate,
     )
Example #30
0
 def _get_sample(self, instance, disk_rates_info):
     return util.make_sample_from_instance(
         instance,
         name='disk.read.bytes.rate',
         type=sample.TYPE_GAUGE,
         unit='B/s',
         volume=disk_rates_info.read_bytes_rate,
     )
Example #31
0
 def _get_sample(instance, c_data):
     return util.make_sample_from_instance(
         instance,
         name='disk.write.bytes',
         type=sample.TYPE_CUMULATIVE,
         unit='B',
         volume=c_data.w_bytes,
     )
Example #32
0
 def _get_samples(self, instance, disk_latency_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.latency',
         type=sample.TYPE_GAUGE,
         unit='ms',
         volume=disk_latency_info.disk_latency / 1000
     )]
Example #33
0
 def get_samples(manager, cache, instance):
     yield util.make_sample_from_instance(
         instance,
         # Use the "meter name + variable" syntax
         name='instance:%s' % instance.flavor['name'],
         type=sample.TYPE_GAUGE,
         unit='instance',
         volume=1,
     )
Example #34
0
 def get_samples(manager, cache, resources):
     for instance in resources:
         yield util.make_sample_from_instance(
             instance,
             name='instance',
             type=sample.TYPE_GAUGE,
             unit='instance',
             volume=1,
         )
Example #35
0
 def get_samples(manager, cache, resources):
     for instance in resources:
         yield util.make_sample_from_instance(
             instance,
             name='instance',
             type=sample.TYPE_GAUGE,
             unit='instance',
             volume=1,
         )
Example #36
0
 def get_samples(manager, cache, instance):
     yield util.make_sample_from_instance(
         instance,
         # Use the "meter name + variable" syntax
         name='instance:%s' %
         instance.flavor['name'],
         type=sample.TYPE_GAUGE,
         unit='instance',
         volume=1,
     )
Example #37
0
 def _get_sample_total_and_local(self, instance, _name, _unit,
                                 c_data, _element):
     """Total / local Pollster and return one Sample"""
     return [util.make_sample_from_instance(
         instance,
         name=_name,
         type=sample.TYPE_GAUGE,
         unit=_unit,
         volume=getattr(c_data, _element),
     )]
Example #38
0
 def get_samples(self, manager, cache, instance):
     self.instances.append((manager, instance))
     test_data_2 = util.make_sample_from_instance(
         instance,
         name='test2',
         type=sample.TYPE_CUMULATIVE,
         unit='units-go-here',
         volume=1,
     )
     return [self.test_data_1, test_data_2]
Example #39
0
 def _get_samples(instance, c_data):
     return [util.make_sample_from_instance(
         instance,
         name='disk.read.requests',
         type=sample.TYPE_CUMULATIVE,
         unit='request',
         volume=c_data.r_requests,
         additional_metadata={
             'device': c_data.per_disk_requests['read_requests'].keys()}
     )]
Example #40
0
 def _get_samples(instance, c_data):
     return [util.make_sample_from_instance(
         instance,
         name='disk.write.bytes',
         type=sample.TYPE_CUMULATIVE,
         unit='B',
         volume=c_data.w_bytes,
         additional_metadata={
             'device': c_data.per_disk_requests['write_bytes'].keys()},
     )]
Example #41
0
 def _get_samples(instance, c_data):
     return [util.make_sample_from_instance(
         instance,
         name='disk.write.bytes',
         type=sample.TYPE_CUMULATIVE,
         unit='B',
         volume=c_data.w_bytes,
         additional_metadata={
             'device': c_data.per_disk_requests['write_bytes'].keys()},
     )]
Example #42
0
 def get_samples(self, manager, cache, instance):
     self.instances.append((manager, instance))
     test_data_2 = util.make_sample_from_instance(
         instance,
         name='test2',
         type=sample.TYPE_CUMULATIVE,
         unit='units-go-here',
         volume=1,
     )
     return [self.test_data_1, test_data_2]
Example #43
0
 def _get_samples(instance, c_data):
     return [util.make_sample_from_instance(
         instance,
         name='disk.read.requests',
         type=sample.TYPE_CUMULATIVE,
         unit='request',
         volume=c_data.r_requests,
         additional_metadata={
             'device': c_data.per_disk_requests['read_requests'].keys()}
     )]
 def _get_samples_task(self, instance, _name, disk_info, _attr1, _attr2):
     """Return one or more Samples for meter 'disk.task.*'."""
     return [util.make_sample_from_instance(
         instance,
         name=_name,
         type=sample.TYPE_GAUGE,
         unit='B',
         volume=getattr(disk_info, _attr1),
         additional_metadata={
             'device': disk_info.per_disk_info[_attr2].keys()},
     )]
Example #45
0
 def _get_samples(self, instance, disk_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.usage',
         type=sample.TYPE_GAUGE,
         unit='B',
         volume=disk_info.physical,
         additional_metadata={
             'device': disk_info.per_disk_info[
                 'physical'].keys()},
     )]
Example #46
0
 def _get_samples(self, instance, disk_rates_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.write.requests.rate',
         type=sample.TYPE_GAUGE,
         unit='requests/s',
         volume=disk_rates_info.write_requests_rate,
         additional_metadata={
             'device': disk_rates_info.per_disk_rate[
                 'write_requests_rate'].keys()},
     )]
Example #47
0
 def _get_samples(self, instance, disk_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.usage',
         type=sample.TYPE_GAUGE,
         unit='B',
         volume=disk_info.physical,
         additional_metadata={
             'device': disk_info.per_disk_info[
                 'physical'].keys()},
     )]
Example #48
0
 def _get_samples(self, instance, disk_rates_info):
     return [util.make_sample_from_instance(
         instance,
         name='disk.write.requests.rate',
         type=sample.TYPE_GAUGE,
         unit='requests/s',
         volume=disk_rates_info.write_requests_rate,
         additional_metadata={
             'device': disk_rates_info.per_disk_rate[
                 'write_requests_rate'].keys()},
     )]
Example #49
0
    def get_samples(self, manager, cache, instance):

        # made lowercase as status value is full caps
        state = vm_states.states[instance.status.lower()]

        yield util.make_sample_from_instance(
            instance,
            name='state',
            type=sample.TYPE_GAUGE,
            unit='state',
            volume=state,
        )
Example #50
0
 def _get_samples_task(self, instance, _name, disk_info, _attr1, _attr2):
     """Return one or more Samples for meter 'disk.task.*'."""
     return [util.make_sample_from_instance(
         self.conf,
         instance,
         name=_name,
         type=sample.TYPE_GAUGE,
         unit='B',
         volume=getattr(disk_info, _attr1),
         additional_metadata={
             'device': disk_info.per_disk_info[_attr2].keys()},
     )]
Example #51
0
 def _get_sample_total_and_local(self, instance, _name, _unit, c_data,
                                 _element):
     """Total / local Pollster and return one Sample"""
     return [
         util.make_sample_from_instance(
             instance,
             name=_name,
             type=sample.TYPE_GAUGE,
             unit=_unit,
             volume=getattr(c_data, _element),
         )
     ]
 def _get_sample_read_and_write(self, instance, _name, _unit, _element,
                                _attr1, _attr2):
     """Read / write Pollster and return one Sample"""
     return [util.make_sample_from_instance(
         instance,
         name=_name,
         type=sample.TYPE_GAUGE,
         unit=_unit,
         volume=getattr(_element, _attr1),
         additional_metadata={
             'device': getattr(_element, _attr2)[_attr1].keys()},
     )]
 def _get_sample_read_and_write(instance, _name, _unit, c_data,
                                _volume, _metadata):
     """Read / write Pollster and return one Sample"""
     return [util.make_sample_from_instance(
         instance,
         name=_name,
         type=sample.TYPE_CUMULATIVE,
         unit=_unit,
         volume=getattr(c_data, _volume),
         additional_metadata={
             'device': c_data.per_disk_requests[_metadata].keys()},
     )]
Example #54
0
 def _get_samples(instance, c_data):
     samples = []
     for disk, value in six.iteritems(c_data.per_disk_requests[
             'write_bytes']):
         samples.append(util.make_sample_from_instance(
             instance,
             name='disk.device.write.bytes',
             type=sample.TYPE_CUMULATIVE,
             unit='B',
             volume=value,
             resource_id="%s-%s" % (instance.id, disk),
         ))
     return samples
Example #55
0
 def _get_samples(self, instance, disk_rates_info):
     samples = []
     for disk, value in six.iteritems(disk_rates_info.per_disk_rate[
             'write_requests_rate']):
         samples.append(util.make_sample_from_instance(
             instance,
             name='disk.device.write.requests.rate',
             type=sample.TYPE_GAUGE,
             unit='requests/s',
             volume=value,
             resource_id="%s-%s" % (instance.id, disk),
         ))
     return samples
Example #56
0
 def _get_samples(self, instance, disk_latency_info):
     samples = []
     for disk, value in six.iteritems(
             disk_latency_info.per_disk_latency['disk_latency']):
         samples.append(
             util.make_sample_from_instance(instance,
                                            name='disk.device.latency',
                                            type=sample.TYPE_GAUGE,
                                            unit='ms',
                                            volume=value / 1000,
                                            resource_id="%s-%s" %
                                            (instance.id, disk)))
     return samples
Example #57
0
 def _get_samples(self, instance, disk_iops_info):
     samples = []
     for disk, value in six.iteritems(
             disk_iops_info.per_disk_iops['iops_count']):
         samples.append(
             util.make_sample_from_instance(instance,
                                            name='disk.device.iops',
                                            type=sample.TYPE_GAUGE,
                                            unit='count/s',
                                            volume=value,
                                            resource_id="%s-%s" %
                                            (instance.id, disk)))
     return samples
Example #58
0
 def _get_samples(self, instance, disk_info):
     samples = []
     for disk, value in six.iteritems(disk_info.per_disk_info['physical']):
         samples.append(
             util.make_sample_from_instance(
                 instance,
                 name='disk.device.usage',
                 type=sample.TYPE_GAUGE,
                 unit='B',
                 volume=value,
                 resource_id="%s-%s" % (instance.id, disk),
             ))
     return samples
Example #59
0
 def _get_samples(self, instance, disk_info):
     samples = []
     for disk, value in six.iteritems(disk_info.per_disk_info[
             'physical']):
         samples.append(util.make_sample_from_instance(
             instance,
             name='disk.device.usage',
             type=sample.TYPE_GAUGE,
             unit='B',
             volume=value,
             resource_id="%s-%s" % (instance.id, disk),
         ))
     return samples
Example #60
0
 def _get_sample_read_and_write(self, instance, _name, _unit, _element,
                                _attr1, _attr2):
     """Read / write Pollster and return one Sample"""
     return [util.make_sample_from_instance(
         self.conf,
         instance,
         name=_name,
         type=sample.TYPE_GAUGE,
         unit=_unit,
         volume=getattr(_element, _attr1),
         additional_metadata={
             'device': getattr(_element, _attr2)[_attr1].keys()},
     )]