Skip to content

5. Telemetry Service

florianagiannuzzi edited this page Dec 3, 2014 · 19 revisions

Install the Telemetry service on the controller node

Install the packages:

# apt-get install ceilometer-api ceilometer-collector ceilometer-agent-central ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier python-ceilometerclient

The Telemetry service uses a database to store information. Specify the location of the database in the configuration file. The examples given here use a MongoDB database on the controller node:

# apt-get install mongodb-server

but you can install MongoDB on any node, including a dedicated one.

By default MongoDB is configured to create several 1 GB files in the /var/lib/mongodb/journal/ directory to support database journaling.

If you need to minimize the space allocated to support database journaling then set the smallfiles configuration key to true in the /etc/mongodb.conf configuration file. This configuration reduces the size of each journaling file to 512 MB.

As the files are created the first time the MongoDB service starts you must stop the service and remove the files for this change to take effect:

# service mongodb stop
# rm /var/lib/mongodb/journal/prealloc.*
# service mongodb start

Configure MongoDB to make it listen on the controller management IP address. Edit the /etc/mongodb.conf file and modify the bind_ip key (replace $CONTROLLER_PUBLIC_IP with the public IP of the controller node):

bind_ip = $CONTROLLER_PUBLIC_IP

Restart the MongoDB service to apply the configuration change:

# service mongodb restart

Create the database and a ceilometer database user (replace $CEILOMETER_DBPASS with a suitable password for the MongoDB database):

# mongo --host $CONTROLLER_PUBLIC_IP --eval '
db = db.getSiblingDB("ceilometer");
db.addUser({user: "ceilometer", pwd: "$CEILOMETER_DBPASS", roles: [ "readWrite", "dbAdmin" ]})'

Configure the Telemetry service to use the database:

Edit the /etc/ceilometer/ceilometer.conf file and change the [database] section (replace $MONGO_IP with the IP address of the node hosting MongoDB):

[database]
# The SQLAlchemy connection string used to connect to the
# database (string value)
connection = mongodb://ceilometer:$CEILOMETER_DBPASS@$MONGO_IP:27017/ceilometer

You must define a secret key that is used as a shared secret among Telemetry service nodes. Use openssl to generate a random token and store it in the configuration file:

# openssl rand -hex 10

Edit the /etc/ceilometer/ceilometer.conf file and change the [publisher] section. Replace $CEILOMETER_TOKEN with the results of the openssl command:

[publisher]
# Secret value for signing metering messages (string value)
metering_secret = $CEILOMETER_TOKEN

Configure the RabbitMQ access:

Edit the /etc/ceilometer/ceilometer.conf file and update the [DEFAULT] section:

rabbit_host = controller
rabbit_password = $RABBIT_PASS

Configure the log directory.

Edit the /etc/ceilometer/ceilometer.conf file and update the [DEFAULT] section:

[DEFAULT]
log_dir = /var/log/ceilometer

Create a ceilometer user that the Telemetry service uses to authenticate with the Identity Service. Use the service tenant and give the user the admin role (replace $CEILOMETER_EMAIL with the email address you want to associate to the telemetry user/service):

$ keystone user-create --name=ceilometer --pass=$CEILOMETER_PASS --email=$CEILOMETER_EMAIL
$ keystone user-role-add --user=ceilometer --tenant=service --role=admin

Configure the Telemetry service to authenticate with the Identity Service.

Set the auth_strategy value to keystone in the /etc/ceilometer/ceilometer.conf file:

[DEFAULT]
...
auth_strategy = keystone

Add the credentials to the configuration files for the Telemetry service:

Edit the /etc/ceilometer/ceilometer.conf file and change the [keystone_authtoken] section:

[keystone_authtoken]
auth_host = controller
auth_port = 35357
auth_protocol = http
auth_uri = http://$CONTROLLER_PUBLIC_IP:5000
admin_tenant_name = service
admin_user = ceilometer
admin_password = $CEILOMETER_PASS

Also set the [service_credentials] section:

[service_credentials]
os_auth_url = http://$CONTROLLER_PUBLIC_IP:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = $CEILOMETER_PASS

Register the Telemetry service with the Identity Service so that other OpenStack services can locate it. Use the keystone command to register the service and specify the endpoint:

$ keystone service-create --name=ceilometer --type=metering --description="Telemetry"
$ keystone endpoint-create --service-id=$(keystone service-list | awk '/ metering / {print $2}') --publicurl=http://$CONTROLLER_PUBLIC_IP:8777 --internalurl=http://controller:8777 --adminurl=http://controller:8777

Restart the services with their new settings:

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

Additional configuration

h3. 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

Restart the Image Services with their new settings:

# service glance-registry restart
# service glance-api restart

h3. To retrieve volume samples, you must configure the Block Storage service to send notifications to the bus.

Edit /etc/cinder/cinder.conf and add in the [DEFAULT] section on the controller and volume nodes:

control_exchange = cinder
notification_driver = cinder.openstack.common.notifier.rpc_notifier

Restart the Block Storage services with their new settings.

On the controller node:

# service cinder-api restart
# service cinder-scheduler restart

On the volume node:

# service cinder-volume restart

h3. To retrieve object store statistics, the Telemetry service needs access to Object Storage with the ResellerAdmin role. Give this role to your os_username user for 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

You must also add the Telemetry middleware to Object Storage to handle incoming and outgoing traffic. Add these lines to the /etc/swift/proxy-server.conf file:

[filter:ceilometer]
use = egg:ceilometer#swift

Add ceilometer to the pipeline parameter of that same file:

[pipeline:main]
pipeline = healthcheck cache authtoken keystoneauth ceilometer proxy-server

Add the python-ceilometer package to the proxy node:

# apt-get install python-ceilometer 

Restart the service with its new settings:

# service swift-proxy restart

NOTE: due to this bug the swift-proxy will not start since it needs the ceilometer.conf file (not installed on this node). Copy it from the ceilometer node

[node01]# scp -r node05:/etc/ceilometer /etc/ceilometer
[node01]# chown swift:swift /etc/ceilometer 
[node01]# mkdir -p /var/log/ceilometer
[node01]# chown swift:swift /var/log/ceilometer  

Install the Telemetry agent on the compute node

To install the agent (which contacts the collector on the controller node) execute on the compute node :

# apt-get install ceilometer-agent-compute

Add the following lines to the [DEFAULT] section of the /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

Restart the Compute service:

# service nova-compute restart

Modify the [publisher] section of the /etc/ceilometer/ceilometer.conf file (replace $CEILOMETER_TOKEN with the secret key set before):

[publisher]
...
metering_secret = $CEILOMETER_TOKEN

To configure the RabbitMQ access, update the [DEFAULT] section of the /etc/ceilometer/ceilometer.conf file:

[DEFAULT]
rabbit_host = controller
rabbit_password = $RABBIT_PASS

To add the Identity service credentials edit the [keystone_authtoken] section of the /etc/ceilometer/ceilometer.conf file:

[keystone_authtoken]
auth_host = controller
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = ceilometer
admin_password = $CEILOMETER_PASS

as well as the [service_credentials] section:

[service_credentials]
os_auth_url = http://$CONTROLLER_PUBLIC_IP:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = $CEILOMETER_PASS

To configure the log directory, edit the [DEFAULT] section of the /etc/ceilometer/ceilometer.conf file:

[DEFAULT]
log_dir = /var/log/ceilometer

Restart the service:

# service ceilometer-agent-compute restart