This article will demonstrates the deployment of telemetry modules on Openstack environment. The telemetry services are developed in the name of ceilometer. Ceilometer provides a framework for monitoring, alarming and metering the OpenStack cloud resources. The Ceilometer efficiently polls metering data related to OpenStack services. It collects event & metering data by monitoring notifications sent from OpenStack services. It publishes collected data to various API targets including data-stores and message-queues. Ceilometer creates an alarm when collected data breaks defined rules.
All the telemetry services will use the messaging bus to communicate with other OpenStack components.
Telemetry Components:
- ceilometer-agent-compute
- ceilometer-agent-central
- ceilometer-agent-notification
- ceilometer-collector
- ceilometer-alarm-evaluator
- ceilometer-alarm-notifier
- ceilometer-api
Configure Controller Node for Celiometer – Prerequisites:
1.Login to the Openstack controller node.
2. Install MongoDB for telemetry services.
root@OSCTRL-UA:~# apt-get install mongodb-server mongodb-clients python-pymongo Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libboost-filesystem1.54.0 libboost-program-options1.54.0 libgoogle-perftools4 libpcrecpp0 libsnappy1 libtcmalloc-minimal4 libunwind8 libv8-3.14.5 python-bson python-bson-ext python-gridfs python-pymongo-ext 0 upgraded, 15 newly installed, 0 to remove and 44 not upgraded. Need to get 14.7 MB of archives. After this operation, 114 MB of additional disk space will be used. Do you want to continue? [Y/n] Y
3. Edit the /etc/mongodb.conf and update the below sections.
Update the bind_ip as controller node IP.
bind_ip = 192.168.203.130
Add the key to reduce the journel file size for mongoDB.
smallfiles = true
4. Stop the mongoDB and remove the journal files if any. Once it’s done you can start the MongoDB to take effect of new settings.
root@OSCTRL-UA:~# service mongodb stop mongodb stop/waiting root@OSCTRL-UA:~# rm /var/lib/mongodb/journal/prealloc.* rm: cannot remove ‘/var/lib/mongodb/journal/prealloc.*’: No such file or directory root@OSCTRL-UA:~# service mongodb start mongodb start/running, process 36834 root@OSCTRL-UA:~#
5. Create the celiometer database on MongoDB.
root@OSCTRL-UA:~# mongo --host OSCTRL-UA --eval 'db = db.getSiblingDB("ceilometer");db.addUser({user: "ceilometer",pwd: "ceilometerdb123",roles: [ "readWrite", "dbAdmin" ]})' MongoDB shell version: 2.4.9 connecting to: OSCTRL-UA:27017/test { "user" : "ceilometer", "pwd" : "4a434c760e1711668b029ab0a744b61f", "roles" : [ "readWrite", "dbAdmin" ], "_id" : ObjectId("5628e718d34ba80568d83895") } root@OSCTRL-UA:~#
6.Source the admin credentials to gain the CLI access.
root@OSCTRL-UA:~# cat admin.rc export OS_USERNAME=admin export OS_PASSWORD=admin123 export OS_TENANT_NAME=admin export OS_AUTH_URL=http://OSCTRL-UA:35357/v2.0 root@OSCTRL-UA:~#
7.Create the ceilometer user on keystone.
root@OSCTRL-UA:~# keystone user-create --name ceilometer --pass ceilometer123 +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | email | | | enabled | True | | id | a51353508ecf415fb0e7e8170300baf8 | | name | ceilometer | | username | ceilometer | +----------+----------------------------------+ root@OSCTRL-UA:~#
8. Add the ceilometer to the admin role.
root@OSCTRL-UA:~# keystone user-role-add --user ceilometer --tenant service --role admin root@OSCTRL-UA:~#
9.Create ceilometer service entity.
root@OSCTRL-UA:~# keystone service-create --name ceilometer --type metering --description "Telemetry" +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | Telemetry | | enabled | True | | id | d4371a7560d243bcb48e9db4d49ce7e1 | | name | ceilometer | | type | metering | +-------------+----------------------------------+ root@OSCTRL-UA:~#
10. Create the Ceilometer API endpoints.
root@OSCTRL-UA:~# keystone endpoint-create --service-id $(keystone service-list | awk '/ metering / {print $2}') --publicurl http://OSCTRL-UA:8777 --internalurl http://OSCTRL-UA:8777 --adminurl http://OSCTRL-UA:8777 --region regionOne +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | adminurl | http://OSCTRL-UA:8777 | | id | b4534beb489d45af8af3aa62ede17053 | | internalurl | http://OSCTRL-UA:8777 | | publicurl | http://OSCTRL-UA:8777 | | region | regionOne | | service_id | d4371a7560d243bcb48e9db4d49ce7e1 | +-------------+----------------------------------+ root@OSCTRL-UA:~#
Install & Configure Ceilometer:
1. Login to the controller node.
2. Install the Ceilometer controller node packages.
root@OSCTRL-UA:~# apt-get install ceilometer-api ceilometer-collector ceilometer-agent-central ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier python-ceilometerclient Reading package lists... Done Building dependency tree Reading state information... Done python-ceilometerclient is already the newest version. python-ceilometerclient set to manually installed. The following extra packages will be installed: smitools 0 upgraded, 38 newly installed, 0 to remove and 44 not upgraded. Need to get 4,504 kB of archives. After this operation, 28.4 MB of additional disk space will be used. Do you want to continue? [Y/n] Y
3. Generate the random HEX value for Ceilometer.
root@OSCTRL-UA:~# openssl rand -hex 10 9342b8f01c16142bdeab root@OSCTRL-UA:~#
4.Edit the /etc/ceilometer/ceilometer.conf file and update the following sections.
In [database] section,
[database] connection = mongodb://ceilometer:ceilometerdb123@OSCTRL-UA:27017/ceilometer
In [DEFAULT] section,
[DEFAULT] rpc_backend = rabbit rabbit_host = OSCTRL-UA rabbit_password = rabbit123 auth_strategy = keystone
In “[keystone_authtoken]” section,
[keystone_authtoken] auth_uri = http://OSCTRL-UA:5000/v2.0 identity_uri = http://OSCTRL-UA:35357 admin_tenant_name = service admin_user = ceilometer admin_password = ceilometer123
In [service_credentials] section,
[service_credentials] os_auth_url = http://OSCTRL-UA:5000/v2.0 os_username = ceilometer os_tenant_name = service os_password = ceilometer123
In “[publisher]” section , update the metering secret key which we have generated in the previous step.
[publisher] metering_secret = 9342b8f01c16142bdeab
5. Restart the ceilometer services to take effect of the new changes.
root@OSCTRL-UA:~# service ceilometer-agent-central restart ceilometer-agent-central stop/waiting ceilometer-agent-central start/running, process 38562 root@OSCTRL-UA:~# service ceilometer-agent-notification restart ceilometer-agent-notification stop/waiting ceilometer-agent-notification start/running, process 38587 root@OSCTRL-UA:~# service ceilometer-api restart ceilometer-api stop/waiting ceilometer-api start/running, process 38607 root@OSCTRL-UA:~# service ceilometer-collector restart ceilometer-collector stop/waiting ceilometer-collector start/running, process 38626 root@OSCTRL-UA:~# service ceilometer-alarm-evaluator restart ceilometer-alarm-evaluator stop/waiting ceilometer-alarm-evaluator start/running, process 38648 root@OSCTRL-UA:~# service ceilometer-alarm-notifier restart ceilometer-alarm-notifier stop/waiting ceilometer-alarm-notifier start/running, process 38667 root@OSCTRL-UA:~#
Configure the Compute service for Telemetry:
1. Login to the compute node.
2. Install the telemetry compute service agent packages.
root@OSCMP-UA:~# apt-get install ceilometer-agent-compute Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: 0 upgraded, 40 newly installed, 0 to remove and 43 not upgraded. Need to get 4,715 kB of archives. After this operation, 29.8 MB of additional disk space will be used. Do you want to continue? [Y/n] y
3.Edit the /etc/ceilometer/ceilometer.conf file and update the following sections.
In [DEFAULT] section,
[DEFAULT] rpc_backend = rabbit rabbit_host = OSCTRL-UA rabbit_password = rabbit123 auth_strategy = keystone
In “[keystone_authtoken]” section,
[keystone_authtoken] auth_uri = http://OSCTRL-UA:5000/v2.0 identity_uri = http://OSCTRL-UA:35357 admin_tenant_name = service admin_user = ceilometer admin_password = ceilometer123
In [service_credentials] section,
[service_credentials] os_auth_url = http://OSCTRL-UA:5000/v2.0 os_username = ceilometer os_tenant_name = service os_password = ceilometer123 os_endpoint_type = internalURL os_region_name = regionOne
In “[publisher]” section , update the metering secret key.
[publisher] metering_secret = 9342b8f01c16142bdeab
4. Edit the /etc/nova/nova.conf and update the default section.
[DEFAULT] ........... instance_usage_audit = True instance_usage_audit_period = hour notify_on_state_change = vm_and_task_state notification_driver = messagingv2
5. Restart the ceilometer compute agent.
root@OSCMP-UA:~# service ceilometer-agent-compute restart ceilometer-agent-compute stop/waiting ceilometer-agent-compute start/running, process 43580 root@OSCMP-UA:~#
6. Restart the nova-compute service to complete the installation.
root@OSCMP-UA:~# service nova-compute restart nova-compute stop/waiting nova-compute start/running, process 43646 root@OSCMP-UA:~#
Configure the Image service to use the Ceilometer:
1. Login to the controller node. (which acts as glance image server as well).
2. Edit the /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf files and update the default sections.
[DEFAULT] ... notification_driver = messagingv2
3. Restart the glance services.
root@OSCTRL-UA:~# service glance-registry restart glance-registry stop/waiting glance-registry start/running, process 38886 root@OSCTRL-UA:~# service glance-api restart glance-api stop/waiting glance-api start/running, process 38902 root@OSCTRL-UA:~#
Configure the Block Storage service to use Ceilometer:
1. Login to the controller node and Storage node.
2.Edit the /etc/cinder/cinder.conf file and update the default section on both controller node & Storage node.
[DEFAULT] ... control_exchange = cinder notification_driver = messagingv2
3. In the controller node , restart the storage services.
root@OSCTRL-UA:~# service cinder-api restart cinder-api stop/waiting cinder-api start/running, process 39005 root@OSCTRL-UA:~# service cinder-scheduler restart cinder-scheduler stop/waiting cinder-scheduler start/running, process 39026 root@OSCTRL-UA:~#
4.In Storage node, restart the storage services.
root@OSSTG-UA:~# service cinder-volume restart cinder-volume stop/waiting cinder-volume start/running, process 32018 root@OSSTG-UA:~#
Configure the Object Storage service to use Ceilometer:
1. The Telemetry service requires access to the Object Storage service using the ResellerAdmin role. Create the “ResellerAdmin” role. Source the admin credentials to use the CLI commands.
root@OSCTRL-UA:~# cat admin.rc export OS_USERNAME=admin export OS_PASSWORD=admin123 export OS_TENANT_NAME=admin export OS_AUTH_URL=http://OSCTRL-UA:35357/v2.0 root@OSCTRL-UA:~# source admin.rc root@OSCTRL-UA:~# root@OSCTRL-UA:~# keystone role-create --name ResellerAdmin +----------+----------------------------------+ | Property | Value | +----------+----------------------------------+ | id | 443599f36fd84821877a460825144ade | | name | ResellerAdmin | +----------+----------------------------------+ root@OSCTRL-UA:~#
2.Add the “ResellerAdmin” role to ceilometer user.
root@OSCTRL-UA:~# keystone user-role-add --tenant service --user ceilometer --role 443599f36fd84821877a460825144ade root@OSCTRL-UA:~#
3.To Configure the notifications, edit the /etc/swift/proxy-server.conf file and update the following section.
In the [filter:keystoneauth] section, add the ResellerAdmin role,
[filter:keystoneauth] ... operator_roles = admin,_member_,ResellerAdmin
In the “[pipeline:main]” section,
[pipeline:main] ... pipeline = authtoken cache healthcheck keystoneauth proxy-logging ceilometer proxy-server
Create the [filter:ceilometer] section and update like below to configure the notification.
[filter:ceilometer] use = egg:ceilometer#swift log_level = WARN
4. Add the “swift” user to the ceilometer group.
root@OSCTRL-UA:~# usermod -a -G ceilometer swift root@OSCTRL-UA:~# id -a swift uid=118(swift) gid=125(swift) groups=125(swift),4(adm),128(ceilometer) root@OSCTRL-UA:~#
5. Restart the Object proxy service.
root@OSCTRL-UA:~# service swift-proxy restart swift-proxy stop/waiting swift-proxy start/running root@OSCTRL-UA:~#
Verify the Telemetry Configuration:
1. Login to the controller node .
2. Source the admin credentials.
root@OSCTRL-UA:~# cat admin.rc export OS_USERNAME=admin export OS_PASSWORD=admin123 export OS_TENANT_NAME=admin export OS_AUTH_URL=http://OSCTRL-UA:35357/v2.0 root@OSCTRL-UA:~# source admin.rc root@OSCTRL-UA:~#
3. List the available meters.
root@OSCTRL-UA:~# ceilometer meter-list <<<Removed due to huge output list>>>
4. Download the OS image for testing purpose.
root@OSCTRL-UA:~# glance image-list +--------------------------------------+---------------------+-------------+------------------+----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+---------------------+-------------+------------------+----------+--------+ | 7d19b639-6950-42dc-a64d-91c6662e0613 | CirrOS 0.3.0 | qcow2 | bare | 9761280 | active | | 95fafce7-ae0f-47e3-b1c9-5d2ebd1af885 | CirrOS-0.3.4-x86_64 | qcow2 | bare | 13287936 | active | +--------------------------------------+---------------------+-------------+------------------+----------+--------+ root@OSCTRL-UA:~# glance image-download "CirrOS-0.3.4-x86_64" > cirros.img_test root@OSCTRL-UA:~#
5. List available meters again to validate detection of the image download.
root@OSCTRL-UA:~# ceilometer meter-list |grep download | image.download | delta | B | 95fafce7-ae0f-47e3-b1c9-5d2ebd1af885 | d154aa743ab4405c80055236c47ed98f | d14d6a07f862482398b3e3e4e8d581c6 | root@OSCTRL-UA:~#
6. Retrieve the usage statics.
root@OSCTRL-UA:~# ceilometer statistics -m image.download +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+ | Period | Period Start | Period End | Max | Min | Avg | Sum | Count | Duration | Duration Start | Duration End | +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+ | 0 | 2015-10-22T14:46:10.946043 | 2015-10-22T14:46:10.946043 | 13287936.0 | 13287936.0 | 13287936.0 | 13287936.0 | 1 | 0.0 | 2015-10-22T14:46:10.946043 | 2015-10-22T14:46:10.946043 | +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+ root@OSCTRL-UA:~#
The above command output confirms that telemetry service is working fine. Now our Openstack environment includes the telemetry service to measure the resource usage.
Hope this article is informative to you. Share it ! Be Sociable !!!
Leave a Reply