简体   繁体   English

为什么 Gnocchi 缓慢地将“server_group”应用于资源?

[英]Why Gnocchi apply 'server_group' to resource slowly?

I add the metadata "metering.server_group":"corey-group" to an instance while creating, and check it by using nova show , it is applied, then I check the Gnocchi resource using gnocchi resource show --type instance ${instance-id} , the attribute server_group is None in the begining, but after a while, it will be applied (always on the hour, ex: 07:00, 08:00...), I have no idea what happens, I think this issue will cause Gnocchi gets incorrect datasets while doing aggregation, so I spent some times to troubleshoot it.我在创建时将元数据"metering.server_group":"corey-group"到实例中,并使用nova show检查它,它已应用,然后我使用gnocchi resource show --type instance ${instance-id}检查gnocchi resource show --type instance ${instance-id} ,属性server_group一开始是None ,但过了一会儿,它会被应用(总是在小时,例如:07:00, 08:00...),我不知道会发生什么,我认为这个问题会导致 Gnocchi 在进行聚合时得到不正确的数据集,所以我花了一些时间来解决它。

First of all, the attributes of Gnocchi resource stored in database:首先,数据库中存储的Gnocchi资源的属性:

MariaDB [(none)]> use gnocchi
MariaDB [gnocchi]> select * from resource_type where name='instance';
# check its tablename, ex: rt_xxxxxx
MariaDB [gnocchi]> select * from rt_xxxxxx where display_name='corey-vm';

+----------------+---------------------+-----------+--------------------------------------+-------------------------+------------------+---+
| display_name   | host                | image_ref | flavor_id                            | server_group | id             | flavor_name  |
+----------------+---------------------+-----------+--------------------------------------+-------------------------+------------------+---+
| corey-vm       | corey-test-com-001  | NULL      | 26e46b4c-23bd-4224-a609-29bd3094a18e | NULL         | xxxxxx         | corey-flavor |
+----------------+---------------------+-----------+--------------------------------------+-------------------------+------------------+---+

As you can see, the column server_group should be corey-group , but it is always NULL when the instance is just created, and seems like ceilometer updates the resource per hour on the hour .正如你所看到的,列server_group应该是corey-group ,但它始终是NULL时,刚刚创建的实例,好像云高仪更新上一小时,每小时的资源。

I added some log in the file ceilometer/publisher/gnocchi.py , and found that it updates resource every minutes, but the variable resource_extra gets server_group only on the hour , that's why it is None is the begining.我在文件ceilometer/publisher/gnocchi.py 中添加了一些日志,发现它每分钟更新一次资源,但是变量resource_extra在 hour获取server_group ,这就是为什么它是 None 的开始。

Here are some parts of the logs这是日志的一些部分

2020-11-09 11:59:15 DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx', 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345 2020-11-09 11:59:15调试 ceilometer.publisher.gnocchi 资源 {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx' , 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345

2020-11-09 12:00:15 DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_name': u'xxx', 'server_group': 'corey-group' } publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345 2020-11-09 12:00:15调试 ceilometer.publisher.gnocchi 资源 {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_name': u'xxx' , 'server_group': 'corey-group' } 发布样本/usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345

2020-11-09 12:01:15 DEBUG ceilometer.publisher.gnocchi Resource {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx', 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345 2020-11-09 12:01:15调试 ceilometer.publisher.gnocchi 资源 {'host': u'test-com-002', 'display_name': u'vm-001', 'flavor_id': u'xxx' , 'flavor_name': u'xxx'} publish_samples /usr/lib/python2.7/site-packages/ceilometer/publisher/gnocchi.py:345

But I stuck at this point, I can't understand why the variable resource_extra can't gets server_group each time.但是我卡在了这一点上,我不明白为什么变量resource_extra每次都无法获取server_group What causes this happpening exactly?究竟是什么原因导致这种情况发生? (Running on Queens) (在皇后区跑步)

I would appreciate any ideas.我将不胜感激任何想法。

Update 09/11/2020更新 09/11/2020

After some days of troubleshooting, I still can't find the root cause.经过几天的故障排除,我仍然找不到根本原因。

But I found a command line to apply the 'server_group' manually, that can help me to avoid Gnocchi gets incorrect datasets to aggregate.但是我找到了一个命令行来手动应用“server_group”,这可以帮助我避免 Gnocchi 获取不正确的数据集进行聚合。

Here it is:这里是:

gnocchi resource update --type instance -a server_group:corey-group ${resource_id}

Update 11/11/2020 2020 年 11 月 11 日更新

I tried to grep the integer 3600 and modify them to 300, but nothing changed, below are what I've tried.我试图grep整数 3600 并将它们修改为 300,但没有任何改变,下面是我尝试过的。

/etc/ceilometer/ceilometer.conf /etc/ceilometer/ceilometer.conf

[compute]
resource_cache_expiry = 300

ceilometer/compute/discovery.py云高仪/计算/discovery.py

cfg.IntOpt('resource_cache_expiry',
            default=300,

ceilometer/publisher/zaqar.py云高仪/出版商/ zaqar.py

DEFAULT_TTL = 300

Update 12/11/2020 2020 年 11 月 12 日更新

I can't reproduce this issue on Pike.我无法在 Pike 上重现此问题。

Maybe you can refer to the following discussions:也许你可以参考以下讨论:

Heat autoscaling with gnocchi based aodh alarms requires use of naive instance_discovery_method setting with ceilometer compute agents? 使用基于 gnocchi 的 aodh 警报进行热自动缩放需要对云高仪计算代理使用简单的 instance_discovery_method 设置?

According to the reference, try to change the default instance_discovery_method from "libvirt_metadata" to "naive" in ceilometer config file, like this:根据参考,尝试将 ceilometer 配置文件中的默认instance_discovery_method从“libvirt_metadata”更改为“naive” ,如下所示:

[compute]
instance_discovery_method = naive

Switching to "naive" resolves this issue, however it obviously generates load on the Nova API for metadata retrieval.切换到“naive”解决了这个问题,但是它显然会在用于元数据检索的 Nova API 上产生负载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM