感谢朋友支持本博客,欢迎共同探讨交流,由于能力和时间有限,错误之处在所难免,欢迎指正!
如果转载,请保留作者信息。
博客地址:http://blog.csdn.net/qq_21398167
原博文地址:http://blog.csdn.net/qq_21398167/article/details/47019751
Before you install andconfigure Telemetry, you must install MongoDB, create a MongoDB database, andcreate Identity service credentials including endpoints.
遥测服务使用数据库来存储信息。指定该数据库的配置文件。这些例子在控制器节点上使用 MongoDB 数据库
1. Install the MongoDBpackage:
# yum install mongodb-server mongodb
配置 MongoDB,使其监听控制器管理 IP 地址
2. Edit the /etc/mongodb.conf file and complete the following actions:
a. Configure the bind_ip key to use the management interface IP address of the controllernode.
bind_ip =192.168.0.66
b. By default, MongoDB createsseveral 1 GB journal files in the /var/lib/mon- godb/journal directory. If you want to reduce the size of each journal file to128 MB and limit total journal space consumption to 512 MB, assert the small- files key:
smallfiles = true
You can also disable journaling. For more information, see theMongoDB manual.
重启 MongoDB 服务,应用此配置
c. Start the MongoDB servicesand configure them to start when the system boots:
# service mongod start
# chkconfig mongod on
创建数据库和 ceilometer 数据库用户(确保你的机器名为 controller,笔者直接使用的 IP)
3. Create the ceilometer database:
# mongo --host controller --eval 'db = db.getSiblingDB("ceilometer"); db.addUser({user: "ceilometer", pwd: "CEILOMETER_DBPASS", roles: [ "readWrite", "dbAdmin" ] })'
Replace ceil〇meter_dbpass with asuitable password.
使本地环境变量生效
附上笔者的文件:
# vi admin-openrc.sh
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=password
export OS_AUTH_URL=http://192.168.0.66:35357/v2.0
4. Source the admin credentials to gain access to admin-only CLI commands:
$ source admin-openrc.sh
创建 ceilometer 用户身份服务。使用 service 租户,给用户 admin 角色
5. To create the Identityservice credentials:
a. Create the ceilometer user:
$ keystone user-create --name ceilometer --pass CEILOMETER_PASS
Replace CEILOMETER—PASS with a suitable password.
b. Link the ceilometer user to the service tenant and admin role:
$ keystone user-role-add --user ceilometer --tenant service --role admin
c. Create the ceilometer service:
$ keystone service-create --name ceilometer --type metering --description "Telemetry"
d. Create the Identity serviceendpoints:
$ keystone endpoint-create --service-id $(keystone service-list | awk '/ metering / {print $2}') --publicurl http://controller:8777 --internalurl http://controller:8777 --adminurl http://controller:8777 --region regionOne
gure the Telemetry modulecomponents
安装的遥测服务
1. Install the packages:
# yum installopenstack-ceilometer-api openstack-ceilometer-collector \openstack-ceilometer-notification openstack-ceilometer-central
openstack-ceilometer-alarm \ python-ceilometerclient
你必须定义一个用作遥测之间的服务共享的密钥节点。使用 OpenSSL 生成一个随机的令牌,并将其存储在配置文件中(如果是在以前环境中添加,切记别再运行这一步,不然会导致以前环境破坏,使用以前的令牌即可)
2. Generate a random value touse as the metering secret:
# openssl rand -hex 10
编辑配置文件
3. Edit the /etc/ceilometer/ceilometer.conf file andcomplete the following actions:
a. In the [database] section, configure database access:
[database]
connection = mongodb://ceilometer:[email protected]:27017/ceilometer
Replace CEILOMETER—DBPASS withthe password you chose for the Telemetry module database.
b In the [default] section, configure RabbitMQmessage broker access:
[DEFAULT]
rpc_backend = rabbit
rabbit_host= controller
rabbit_password = RABBIT_PASS
Replace ra^bbit_pa^SS with the password youchose for the guestaccount in RabbitMQ.
a. In the [DEFAULT] and [keystone_authtoken]sections, configure Identity service access:
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http:// 192.168.0.11:5000/v2.0
identity_uri = http://192.168.0.11:35357
admin_tenant_name = service
admin_user = ceilometer
admin_password = CEILOMETER_PASS
Replace CEILOmeter_pass with thepassword you chose for the celiometer user in theIdentity service.
Note
Comment out any auth_host, auth_port, and auth_protocoloptions because the identity_uri option replaces them.
b. In the [service_credentials] section, configure service credentials:
[service_credentials]
os_auth_url = http:// controller:5000/v2.
os_username = ceilometer os_tenant_name = service
os_password = CEIL〇METER_PASS
Replace CEIL〇meter_pass with thepassword you chose for the ceilometer user in theIdentity service.
c. In the [publisher] section, configure the metering secret:
[publisher]
metering_secret= METERING_SECRET(填写上边生成的随机值)
Replace metering_Secret with therandom value that you generated in a previous step.
OpenStack Installation Guide for Red Hat Enterprise Linux, CentOS,and Fedora
To finalize installation
重启服务
• Start the Telemetryservices and configure them to start when the system boots:
# systemctlenable openstack-ceilometer-api.service openstack-ceilometer-notification.service \
openstack-ceilometer-central.serviceopenstack-ceilometer-collector. service \
openstack-ceilometer-alarm-evaluator.serviceopenstack-ceilometer-alarm- notifier.service
# systemctlstart openstack-ceilometer-api.service openstack-ceilometer- notification.service\
openstack-ceilometer-central.serviceopenstack-ceilometer-collector. service \
openstack-ceilometer-alarm-evaluator.serviceopenstack-ceilometer-alarm- notifier.service
Installthe Compute agent for Telemetry
在计算节点上
Telemetry iscomposed of an API service, a collector and a range of disparate agents. Thissection explains how to install and configure the agent that runs on thecompute node.
To configure prerequisites
安装计算代理遥测
1. Install the package:
# yum installopenstack-ceilometer-compute python-ceilometerclient python- pecan
编辑/etc/nova/nova.conf
2. Edit the /etc/nova/nova.conf file and add the following lines to the [default] section:
[default]
instance_usage_audit = Trueinstance_usage_audit_period = hour notify_on_state_change = vm_and_task_state
notification_driver = nova.openstack.common.notifier.rpc_notifiernotification_driver = ceilometer.compute.nova_notifier
重启计算服务:
3. Restart the Computeservice:
# systemctl restart openstack-nova-compute.service
To configure the Computeagent for Telemetry
配置
Edit the /etc/ceilometer/ceilometer.conf file andcomplete the following actions:
1. In the [publisher] section, set the secret key for Telemetry service nodes:
[publisher]
# Secretvalue for signing metering messages (string value) metering_secret = CEIL〇METER_T〇KEN
Replace CEIL〇meter_t〇k^en with theceilometer token that you created previously.
2. In the [default] section, configure RabbitMQ broker access:
[DEFAULT]
rabbit_host = controller
rabbit_password= RABBIT_PASS
Replace ra^bbit_pa^sS with the password youchose for the guest account in Rabbit- MQ. —
3. In the [keystone_authtoken] section, configure Identity service access:
[keystone_authtoken]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
admin_tenant_name = service
admin_user = ceilometer
admin_password = CEIL〇METER_PASS
Replace 〇eil〇meter_pa^sS with the password you chose for the Telemetry module database.
Note
Comment outthe auth_host, auth_port, and auth_protocolkeys, since they are replaced by the identity_uri and auth_urikeys.
4. In the [service_credentials] section, configure service credentials:
[service_credentials]
os_auth_url =http://controller:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = CEIL〇METER_PASS
os_endpoint_type= internalURL
Replace CEILOMETER_PASSwith the password you chose for the ceilometer user in the Identity service.
To finish installation
重启其新设置的服务
• Start the service andconfigure it to start when the system boots:
# systemctl enableopenstack-ceilometer-compute.service
# systemctl start openstack-ceilometer-compute.service
Configurethe Image Service for Telemetry
1. To retrieve image samples,you must configure the Image Service to send notifications to the bus.
Edit /etc/glance/glance-api.conf and modify the[DEFAULT]section:
notification_driver = messaging rpc_backend =rabbit
rabbit_host = controller
rabbit_password= RABBIT_PASS
2. Restart the Image Serviceswith their new settings:
OpenStack Installation Guide for Red Hat Enterprise Linux, CentOS,and Fedora
#systemctl restart registry.service
Add theBlock Storage service agent for Telemetry
1. To retrieve volume samples,you must configure the Block Storage service to send notifications to the bus.
Edit /etc/cinder/cinder.confand add in the [DEFAULT] sectionon the controller and volume nodes:
control_exchange = cinder
notification_driver = cinder.openstack.common.notifier.rpc_notifier
2. Restart the Block Storageservices with their new settings.
On the controller node:
# systemctl restart openstack-cinder-api.serviceopenstack-cinder- scheduler.service
On the storage node:
# systemctlrestart openstack-cinder-volume.service
3. If you want to collectOpenStack Block Storage notification on demand, you can usecinder-volume-usage-audit from OpenStack Block Storage. For more information,
BlockStorage audit script setup to get notifications.
Configure the ObjectStorage service for Telemetry
1. Install thepython-ceilometerclient package on your Object Storage proxy server:
# yum install python-ceilometerclient
2. To retrieve object storestatistics, the Telemetry service needs access to Object Storage with the ResellerAdmin role. Give this role to your os_username userfor the
os_tenant_name tenant:
$ keystone role-create--name ResellerAdmin
+--------- +---------------------------------- +
| Property | Value |
+--------- +---------------------------------- +
| id | 462fa46c13fd4798a95a3bfbe27b5e54 |
| name 丨 ResellerAdmin |
+--------- +---------------------------------- +
$keystone user-role-add--tenant service --user ceilometer \
--role 462fa46c13fd4798a95a3bfbe27b5e54
3. You must also add theTelemetry middleware to Object Storage to handle incoming and outgoing traffic.Add these lines to the /etc/swift/proxy-server.conf file:
OpenStack Installation Guide for Red Hat Enterprise Linux, CentOS,and Fedora
[filter:ceilometer]use = egg:ceilometer#swift
4. Add ceilometer tothe pipeline parameter of that same file:
[pipeline:main]
pipeline = healthcheck cache authtoken keystoneauthceilometer proxy- server
5. Add the system user swift to the system group ceilometer to giveObject Storage access to the ceilometer.conf file.
# usermod -a -G ceilometer swift
6. Add ResellerAdmin to the operator_roles parameter of that samefile:
operator_roles =Member,admin,swiftoperator,_member_,ResellerAdmin
7. Restart the service withits new settings:
# systemctl restart openstack-swift-proxy.service
Verifythe Telemetry installation
To test the Telemetryinstallation, download an image from the Image Service, and use the ceilometercommand to display usage statistics.
1. Use the ceilometer meter-list command to test the access to Telemetry:
$ ceilometer meter-list
2. Download an image from theImage Service:
$ glanceimage-download "cirros-0.3.3-x86_64" > cirros.img
3. Call the ceilometer meter-list command again to validate that the download has been detected andstored by the Telemetry:
$ ceilometermeter-list
+--------------- +------ +----- +--------------------------------------
+-------- +---------------------------------- +
| Name | Type | Unit | ResourceID |
User ID | Project ID |
+--------------- +------ +----- +--------------------------------------
+-------- +---------------------------------- +
| image | gauge | image | acafc7c0-40aa-4026-9673-b879898e1fc2 |
None | efa984b0a914450e9a47788ad330699d |
| image.download | delta | B | acafc7c0-40aa-4026-9673-b879898e1fc2 |
None | efa984b0a914450e9a47788ad330699d |
| image.serve | delta | B | acafc7c0-40aa-4026-9673-b879898e1fc2 |
None | efa984b0a914450e9a47788ad330699d |
| image.size | gauge | B | acafc7c0-40aa-4026-9673-b879898e1fc2 |
None | efa984b0a914450e9a47788ad330699d |
4. You can now get usagestatistics for the various meters:
$ ceilometer statistics -m image.download -p 60 |