Installing OpenStack Telemetry

The OpenStack Telemetry project, also called Ceilometer, provides you with the ability to collect metering data of the physical and virtual resources comprising deployed OpenStack components and persist this data for subsequent retrieval and analysis. It can also trigger actions when the defined criteria are met.

Getting ready

Ensure you have suitable servers running the OpenStack components. If you are using the accompanying Vagrant environment, as described in the Preface, we will use the same controller and compute-01 nodes for this recipe.

We will be installing Ceilometer packages on a controller node and a compute node. Ensure you are logged into the controller and compute-01 nodes in our environment. If you created these nodes with Vagrant, you can execute the following command:

vagrant ssh controller
vagrant ssh compute-01

How to do it...

To enable the Telemetry (ceilometer) service, first carry out the following steps on the controller node:

  1. Ceilometer requires its own database to store all the data it collects. We will install MongoDB and the required dependencies to use with OpenStack's Telemetry service. On a controller node, execute the following command:
    sudo apt-get install mongodb python-pymongo python-bson
    
  2. After installing MongoDB, edit the MongoDB configuration file /etc/mongodb.conf on the controller node and set the bind_ip parameter:
    bind_ip = 172.16.0.200
  3. Restart MongoDB as follows:
    sudo service mongodb restart
    
  4. MongoDB uses JavaScript syntax for its commands. To configure MongoDB for use with Ceilometer, add the ceilometer user by issuing the following command:
    db.addUser( { user: "ceilometer",
                  pwd: "openstack",
                  roles: [ "readWrite", "dbAdmin" ]
                } );
  5. Keystone needs to be aware of Ceilometer, so ensure that there are Keystone credentials for the ceilometer service by executing the following commands:
    keystone user-create --name=ceilometer --pass=ceilometer  
    --email=ceilomoter@localhost 
    keystone user-role-add --user=ceilometer 
    --tenant=service --role=admin
    
  6. We then add the following service and endpoint for Ceilometer in Keystone by executing the following commands:
    keystone service-create --name=ceilometer 
    --type=telemetry 
    --description="Ceilometer Metering Service"
    METERING_SERVICE_ID=$(keystone service-list 
    | awk '/ ceilometer / {print $2}')
    keystone endpoint-create 
      --region RegionOne 
      --service-id=${METERING_SERVICE_ID} 
      --publicurl=http://192.168.100.200:8777 
      --internalurl=http://192.168.100.200:8777 
      --adminurl=http://192.168.100.200:8777
    
  7. We are now ready to install the required ceilometer packages using apt:
    sudo apt-get update
    sudo apt-install ceilometer-api 
    ceilometer-collector 
    ceilometer-agent-central 
    python-ceilometerclient
    
  8. Configure ceilometer by editing the /etc/ceilometer/ceilometer.conf file. It should contain the following configuration to work with our environment:
    [DEFAULT]
    policy_file = /etc/ceilometer/policy.json
    verbose = true
    debug = true
    insecure = true
     
    ##### AMQP #####
    notification_topics = notifications,glance_notifications
     
    rabbit_host=172.16.0.200
    rabbit_port=5672
    rabbit_userid=guest
    rabbit_password=guest
    rabbit_virtual_host=/
    rabbit_ha_queues=false
     
    [database]
    connection=mongodb://ceilometer:[email protected]:27017/ceilometer
     
    [api]
    host = 172.16.0.200
    port = 8777
     
    [keystone_authtoken]
    auth_uri = https://192.168.100.200:35357/v2.0/
    identity_uri = https://192.168.100.200:5000
    admin_tenant_name = service
    admin_user = ceilometer
    admin_password = ceilometer
    revocation_cache_time = 10
    insecure = True
    
    [service_credentials]
    os_auth_url = https://192.168.100.200:5000/v2.0
    os_username = ceilometer
    os_tenant_name = service
    os_password = ceilometer
    insecure = True 
  9. We restart all ceilometer services:
    sudo service ceilometer-agent-central restart
    sudo service ceilometer-agent-notification restart
    sudo service ceilometer-alarm-evaluator restart
    sudo service ceilometer-alarm-notifier restart
    sudo service ceilometer-api restart
    sudo service ceilometer-collector restart
    

    Now that controller node is set up, we proceed to install the Ceilometer agent on a compute-01 node.

  10. On a compute-01 node, install the ceilometer agent:
    sudo apt-get install ceilometer-agent-compute
    
  11. Edit the /etc/ceilometer/ceilometer.conf file and insert the following lines:
    [DEFAULT]
    policy_file = /etc/ceilometer/policy.json
    verbose = true
    debug = true
    insecure = true
     
    ##### AMQP #####
    notification_topics = notifications,glance_notifications
     
    rabbit_host=172.16.0.200
    rabbit_port=5672
    rabbit_userid=guest
    rabbit_password=guest
    rabbit_virtual_host=/
    rabbit_ha_queues=false
     
    [database]
    connection=mongodb://ceilometer:[email protected]:27017/ceilometer
     
    [api]
    host = 172.16.0.200
    port = 8777
     
    [keystone_authtoken]
    auth_uri = https://192.168.100.200:35357/v2.0/
    identity_uri = https://192.168.100.200:5000
    admin_tenant_name = service
    admin_user = ceilometer
    admin_password = ceilometer
    revocation_cache_time = 10
    insecure = True
    [service_credentials]
    os_auth_url = https://192.168.100.200:5000/v2.0
    os_username = ceilometer
    os_tenant_name = service
    os_password = ceilometer
    insecure = True
  12. Add the Ceilometer section to the /etc/nova/nova.conf configuration file:
    # Ceilometer
    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
  13. Restart the nova services:
    sudo service nova-compute restart
    
  14. Restart the Ceilometer agent:
    sudo service ceilometer-agent-compute restart
    

Your compute node is now reporting all its usage statistics to the controller node.

How it works...

We installed and configured MongoDB on our controller node. We set up MongoDB to listen on the internal controller IP, which is similar to the RabbitMQ service. Ceilometer uses Keystone for communication, so we also created a ceilometer user and services using keystone commands. After creating the ceilometer user, we installed and configured ceilometer packages. The configuration file for Ceilometer is /etc/ceilometer/ceilometer.conf. Apart from the [api], [keystone_authtoken], and [service_credentials] sections, we also specified the database connection section:

[database]
connection=mongodb://ceilometer:[email protected]:27017/ceilometer

Tip

To properly configure the MongoDB database for production use, refer to the MongoDB documentation at http://docs.mongodb.org/manual/.

We could have used any supported database, such as MongoDB, MySQL, PostgreSQL, HBase, and DB2.

After configuring the controller node, we set up the compute-01 node by installing the Ceilometer agent. We then updated the /etc/ceilometer.conf and /etc/nova/nova.conf files. Now, the Ceilometer service is ready to be used.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset