[shlug] openstack ceilometer cpu_util sample 问题

220 views
Skip to first unread message

Tsing

unread,
Oct 15, 2014, 5:42:33 AM10/15/14
to sh...@googlegroups.com
LibvirtInspector 默认是没有实现 inspect_cpu_util
接口的,按理应该不会取到 sample 啊,可实验结果怎么就有了呢?
另,我还把 agent-central、agent-notification 关了的。

实在想不出还有哪里取到的,求大神指点一二,thanks。

root@All-in-one:~# tail -f /var/log/ceilometer/ceilometer-agent-compute.log
2014-10-15 13:23:55.219 16011 ERROR ceilometer.compute.pollsters.cpu [-] Obtaining CPU Util is not implemented for LibvirtInspector
^C
root@All-in-one:~# ceilometer sample-list -m cpu_util
+--------------------------------------+----------+-------+---------------+------+---------------------+
| Resource ID | Name | Type | Volume | Unit | Timestamp |
+--------------------------------------+----------+-------+---------------+------+---------------------+
| fb73c083-30fa-488a-9578-2f2b06021830 | cpu_util | gauge | 7.34666666667 | % | 2014-10-15T05:23:55 |
| fb73c083-30fa-488a-9578-2f2b06021830 | cpu_util | gauge | 7.56113902848 | % | 2014-10-15T05:08:12 |
| fb73c083-30fa-488a-9578-2f2b06021830 | cpu_util | gauge | 8.54801324503 | % | 2014-10-15T04:58:15 |
+--------------------------------------+----------+-------+---------------+------+---------------------+

kevinzhang

unread,
Oct 15, 2014, 9:17:08 PM10/15/14
to sh...@googlegroups.com
你看一下ceilometer compute agent那块是如何取虚拟机的CPU信息代码。目前肯定是可以取到CPU的使用信息,应该是调用了libvirt的那块接口。
> --
> -- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to sh...@googlegroups.com. To unsubscribe from this group, send email to shlug+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/shlug?hl=zh-CN
> ---
> 您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到shlug+un...@googlegroups.com
> 要查看更多选项,请访问 https://groups.google.com/d/optout

Tsing

unread,
Oct 15, 2014, 10:59:30 PM10/15/14
to sh...@googlegroups.com
正是因为看了代码,才觉得奇怪的。
轮寻获取代码如下,LibvirtInspector 默认确实是没实现 inspect_cpu_util 接口啊。
LibvirtInspector 只实现了 inspect_cpus 接口,那个是 cpu 个数。
我上封邮件,agent compute 日志里一直提示没有实现的。
另 master 分支也没实现的。
https://github.com/openstack/ceilometer/blob/master/ceilometer/compute/virt/libvirt/inspector.py

class CPUUtilPollster(plugin.ComputePollster):

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 = manager.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 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}))

Tsing

unread,
Oct 16, 2014, 2:29:33 AM10/16/14
to sh...@googlegroups.com
cpu_util 等是通过 transformer 做的,忽略这个了。

du quanlong

unread,
Nov 24, 2015, 5:26:12 AM11/24/15
to Shanghai Linux User Group
是怎么用tranformer计算的???




在 2014年10月15日星期三 UTC+8下午5:42:33,Tsing Wang写道:

唐毅

unread,
Feb 25, 2016, 2:25:38 AM2/25/16
to Shanghai Linux User Group
我也遇到了这个问题,难道是ceilometer compute agent取到cpu的值(从代码来看这个值不是个数,而是CPU时间),然后通过transformer得到cpu util的值吗?
但是具体又是如何计算的呢?

在 2014年10月16日星期四 UTC+8下午2:29:33,Tsing Wang写道:
> > > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到shlug+unsubscribe@googlegroups.com
> > > 要查看更多选项,请访问 https://groups.google.com/d/optout
> >
> > --
> > -- You received this message because you are subscribed to the Google Groups Shanghai Linux User Group group. To post to this group, send email to sh...@googlegroups.com. To unsubscribe from this group, send email to shlug+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/shlug?hl=zh-CN
> > ---
> > 您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”论坛。
> > 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到shlug+unsubscribe@googlegroups.com
> > 要查看更多选项,请访问 https://groups.google.com/d/optout
Reply all
Reply to author
Forward
0 new messages