我是靠谱客的博主 大气鸭子,最近开发中收集的这篇文章主要介绍[部署篇11]VMWare搭建Openstack——Ceilometer的安装与配置,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

对于一个云环境来说,我们不但能够虚拟化出相关的虚拟机来,我们也需要来检测相关虚拟机对象的信息,例如CPU、内存、IO等,那么Openstack有一个ceilometer组件可以帮助我们获得这些信息。


测量 (Metering):Ceilometer。像一个漏斗一样,能把OpenStack内部发生的几乎所有的事件都收集起来,然后为计费和监控以及其它服务提供数据支撑。自Havana版本集成到项目中。Ceilometer作为OpenStack内部 notification的最大消费者,OpenStack内部发生的一些事件都会发出对应的notification消息,比如说创建和删除instance,这些 信息是计量/计费的重要信息,因此第一种方式是Ceilometer第一数据来源,但是有些计量信息通过notification消息是获取不到的, 比如说instance的CPU的运行时间,或者是CPU的使用率,这些信息不会通过notification消息发送出来,因此Ceilometer增加了第二种 方式,周期性的调用相关的API去获取这些信息。


下面先介绍一下怎么安装Ceilometer组件


一、在控制节点上做以下操作(192.168.3.180)


1、安装组件
sudo aptitude install ceilometer-api ceilometer-collector ceilometer-agent-central ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier python-ceilometerclient

2、安装mongodb

与其他组件安装在MySQL不同的是,Ceilometer组件存储的数据在MongoDB,个人认为可能这些数据量比较大,而且需要实时获取,MongoDB效率方面较MySQL会好一些。

sudo apt-get install mongodb-server

3、编辑MongoDB的配置文件

sudo vi /etc/mongodb.conf
更新服务器IP信息:bind_ip = 192.168.3.180


4、 重启MongoDB服务

sudo service mongodb restart


5、创建数据库和ceilometer数据库用户
          库名: ceilometer
 账户: ceilometerdbadmin
 密码: ceilometer4smtest

sudo mongo --host 192.168.3.180 --eval '
db = db.getSiblingDB("ceilometer");
db.addUser({user: "ceilometerdbadmin",
pwd: "ceilometer4smtest",
roles: [ "readWrite", "dbAdmin" ]})'

sm@controller:~$ sudo mongo --host 192.168.3.180 --eval '
> db = db.getSiblingDB("ceilometer");
> db.addUser({user: "ceilometerdbadmin",
> pwd: "ceilometer4smtest",
> roles: [ "readWrite", "dbAdmin" ]})'
MongoDB shell version: 2.4.9
connecting to: 192.168.3.180:27017/test
{
        "user" : "ceilometerdbadmin",
        "pwd" : "693449936c0cdcf9d0da2d3c2246122d",
        "roles" : [
                "readWrite",
                "dbAdmin"
        ],
        "_id" : ObjectId("55419f02f1437115033e6bb6")
}

6、配置数据库信息
sudo vi /etc/ceilometer/ceilometer.conf
[database]
# The SQLAlchemy connection string used to connect to the
# database (string value)
connection = mongodb://ceilometerdbadmin:ceilometer4smtest@192.168.3.180:27017/ceilometer

7、定义一个key

sudo openssl rand -hex 10
sm@controller:~$ sudo openssl rand -hex 10
80f7bb8ca173a3fd8fab

sudo vi /etc/ceilometer/ceilometer.conf
[publisher]
# Secret value for signing metering messages (string value)
metering_secret = 80f7bb8ca173a3fd8fab

8、配置消息信息
sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
rpc_backend = ceilometer.openstack.common.rpc.impl_kombu
rabbit_host = 192.168.3.180
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = mq4smtest

9、配置日志目录
sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
log_dir = /var/log/ceilometer

10、keystone创建ceilometer服务用户和角色


keystone user-create --name=ceilometer --pass=ceilometer4smtest --email=sm@163.com
sm@controller:~$ keystone user-create --name=ceilometer --pass=ceilometer4smtest --email=sm@163.com
+----------+----------------------------------+
| Property |              Value               |
+----------+----------------------------------+
|  email   |             sm@163.com           |
| enabled  |               True               |
|    id    | 4fd9cbdca36f414590adf65cfe343743 |
|   name   |            ceilometer            |
| username |            ceilometer            |
+----------+----------------------------------+

keystone user-role-add --user=ceilometer --tenant=service --role=admin


11、更新配置文件的keystone信息

sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://192.168.3.180:5000
auth_host = 192.168.3.180
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = ceilometer
admin_password = ceilometer4smtest

添加如下section
[service_credentials]
os_auth_url = http://192.168.3.180:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = ceilometer4smtest

12、创建服务
keystone service-create --name=ceilometer --type=metering
--description="Telemetry"
sm@controller:~$ keystone service-create --name=ceilometer --type=metering 
> --description="Telemetry"
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
| description |            Telemetry             |
|   enabled   |               True               |
|      id     | 8add6525e59c4c4cb62b04065dd0f353 |
|     name    |            ceilometer            |
|     type    |             metering             |
+-------------+----------------------------------+

keystone endpoint-create
--service-id=$(keystone service-list | awk '/ metering / {print $2}')
--publicurl=http://192.168.3.180:8777
--internalurl=http://192.168.3.180:8777
--adminurl=http://192.168.3.180:8777
sm@controller:~$ keystone endpoint-create 
> --service-id=$(keystone service-list | awk '/ metering / {print $2}') 
> --publicurl=http://192.168.3.180:8777 
> --internalurl=http://192.168.3.180:8777 
> --adminurl=http://192.168.3.180:8777
+-------------+----------------------------------+
|   Property  |              Value               |
+-------------+----------------------------------+
|   adminurl  |    http://192.168.3.180:8777     |
|      id     | 31f58a6be962408bbd280cf2b5dd747c |
| internalurl |    http://192.168.3.180:8777     |
|  publicurl  |    http://192.168.3.180:8777     |
|    region   |            regionOne             |
|  service_id | 8add6525e59c4c4cb62b04065dd0f353 |
+-------------+----------------------------------+

13、重启服务

sudo service ceilometer-agent-central restart
sudo service ceilometer-agent-notification restart
sudo service ceilometer-api restart
sudo service ceilometer-collector restart
sudo service ceilometer-alarm-evaluator restart
sudo service ceilometer-alarm-notifier restart



二、所有的计算节点,做如下安装

1、sudo apt-get install ceilometer-agent-compute

2、sudo vi /etc/nova/nova.conf
[DEFAULT]
instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
notification_driver = nova.openstack.common.notifier.rpc_notifier
notification_driver = ceilometer.compute.nova_notifier

3、重启计算服务
sudo service nova-compute restart


4、定义一个key

如果控制节点和计算节点是一台物理机,该Key无需再生成,如果不是,在计算节点需要重新生成)

sudo openssl rand -hex 10

sm@controller:~$ sudo openssl rand -hex 10
80f7bb8ca173a3fd8fab
sudo vi /etc/ceilometer/ceilometer.conf   
[publisher]
# Secret value for signing metering messages (string value)
metering_secret = 80f7bb8ca173a3fd8fab

5、配置消息信息
sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
rpc_backend = ceilometer.openstack.common.rpc.impl_kombu
rabbit_host = 192.168.3.180
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = mq4smtest

6、更新配置文件的keystone信息

sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://192.168.3.180:5000
auth_host = 192.168.3.180
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = ceilometer
admin_password = ceilometer4smtest

添加如下section
[service_credentials]
os_auth_url = http://192.168.3.180:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = ceilometer4smtest

7、配置日志目录
sudo vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
log_dir = /var/log/ceilometer

8、重启服务
sudo service ceilometer-agent-compute restart




三、控制节点为镜像服务配置

1、sudo vi /etc/glance/glance-api.conf
[DEFAULT]
notification_driver = messaging
rpc_backend = rabbit
rabbit_host = 192.168.3.180
rabbit_password = mq4smtest

2、重启服务
sudo service glance-registry restart
sudo service glance-api restart






四、块服务配置(哪个节点有块服务就在哪个节点配置)

1、sudo vi /etc/cinder/cinder.conf
[DEFAULT]
control_exchange = cinder
notification_driver = cinder.openstack.common.notifier.rpc_notifier

2、重启服务
sudo service cinder-api restart
sudo service cinder-scheduler restart
sudo service cinder-volume restart

五、验证安装
1、查看meter列表
ceilometer meter-list
sm@controller:~$ ceilometer meter-list
+--------------------------+------------+-----------+--------------------------------------


+----------------------------------+----------------------------------+
| Name                     | Type       | Unit      | Resource ID                          | User ID                   


       | Project ID                       |
+--------------------------+------------+-----------+--------------------------------------


+----------------------------------+----------------------------------+
| cpu                      | cumulative | ns        | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| cpu_util                 | gauge      | %         | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.read.bytes          | cumulative | B         | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.read.bytes.rate     | gauge      | B/s       | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.read.requests       | cumulative | request   | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.read.requests.rate  | gauge      | request/s | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.write.bytes         | cumulative | B         | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.write.bytes.rate    | gauge      | B/s       | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.write.requests      | cumulative | request   | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| disk.write.requests.rate | gauge      | request/s | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| image                    | gauge      | image     | f2b0f15b-bd5e-4766-973c-24547c1faf03 | None                      


       | b500268a41e34752aba847c7ea464870 |
| image.size               | gauge      | B         | f2b0f15b-bd5e-4766-973c-24547c1faf03 | None                      


       | b500268a41e34752aba847c7ea464870 |
| instance                 | gauge      | instance  | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
| instance:m1.tiny         | gauge      | instance  | 8f546f0e-4365-4e0e-b1c5-a6a3ec22ef6d | 


9b1cdfc2b5614eb39f042317f54a286c | b500268a41e34752aba847c7ea464870 |
+--------------------------+------------+-----------+--------------------------------------


+----------------------------------+----------------------------------+

2、下载镜像服务
glance image-download "cirros-0.3.2-x86_64" > cirros.img
再次查看ceilometer meter-list

3、获得统计信息
ceilometer statistics -m image.download -p 60

五、在horzion里面查看


我们可以看到,管理员项,新增了一个资源使用情况,里面包括日报和统计数据





日报



统计数据


最后

以上就是大气鸭子为你收集整理的[部署篇11]VMWare搭建Openstack——Ceilometer的安装与配置的全部内容,希望文章能够帮你解决[部署篇11]VMWare搭建Openstack——Ceilometer的安装与配置所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(90)

评论列表共有 0 条评论

立即
投稿
返回
顶部