这个部分描述如何在控制节点上安装和配置计量(Telemetry)服务,即OpenStack Ceilometer项目。计量服务收集OpenStack大部分服务的测量结果,且可选择性的触发警告。
安装和配置Telemetry服务之前,你必须创建创建一个数据库、服务凭证和API端点。但是,不像其他服务,Telemetry服务使用NoSQL 数据库。在进一步处理之前查看 ref:environment-nosql-database 来安装和配置MongoDB。
创建 ceilometer 数据库:
# mongo --host controller --eval '
db = db.getSiblingDB("ceilometer");
db.createUser({user: "ceilometer",
pwd: "CEILOMETER_DBPASS",
roles: [ "readWrite", "dbAdmin" ]})'
MongoDB shell version: 2.6.x
connecting to: controller:27017/test
Successfully added user: { "user" : "ceilometer", "roles" : [ "readWrite", "dbAdmin" ] }
用合适的密码替换 CEILOMETER_DBPASS。
获得 admin 凭证来获取只有管理员能执行命令的访问权限:
$ source admin-openrc.sh
要创建服务证书,完成这些步骤:
创建 ceilometer 用户:
$ openstack user create --domain default --password-prompt ceilometer
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field | Value |
+-----------+----------------------------------+
| domain_id | default |
| enabled | True |
| id | c859c96f57bd4989a8ea1a0b1d8ff7cd |
| name | ceilometer |
+-----------+----------------------------------+
添加 admin 角色到 ceilometer 用户上。
$ openstack role add --project service --user ceilometer admin
注解
这个命令执行后没有输出。
创建 ceilometer 服务实体:
$ openstack service create --name ceilometer \
--description "Telemetry" metering
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Telemetry |
| enabled | True |
| id | 5fb7fd1bb2954fddb378d4031c28c0e4 |
| name | ceilometer |
| type | metering |
+-------------+----------------------------------+
创建Telemetry服务API端点
$ openstack endpoint create --region RegionOne \
metering public http://controller:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | b808b67b848d443e9eaaa5e5d796970c |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 5fb7fd1bb2954fddb378d4031c28c0e4 |
| service_name | ceilometer |
| service_type | metering |
| url | http://controller:8777 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
metering internal http://controller:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | c7009b1c2ee54b71b771fa3d0ae4f948 |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 5fb7fd1bb2954fddb378d4031c28c0e4 |
| service_name | ceilometer |
| service_type | metering |
| url | http://controller:8777 |
+--------------+----------------------------------+
$ openstack endpoint create --region RegionOne \
metering admin http://controller:8777
+--------------+----------------------------------+
| Field | Value |
+--------------+----------------------------------+
| enabled | True |
| id | b2c00566d0604551b5fe1540c699db3d |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | 5fb7fd1bb2954fddb378d4031c28c0e4 |
| service_name | ceilometer |
| service_type | metering |
| url | http://controller:8777 |
+--------------+----------------------------------+
安装软件包:
# yum install openstack-ceilometer-api \
openstack-ceilometer-collector openstack-ceilometer-notification \
openstack-ceilometer-central openstack-ceilometer-alarm \
python-ceilometerclient
编辑 /etc/ceilometer/ceilometer.conf,同时完成如下动作:
在 [database] 部分,配置数据库访问:
[database]
...
connection = mongodb://ceilometer:CEILOMETER_DBPASS@controller:27017/ceilometer
用你选择的Telemtry服务数据库密码替换 CEILOMETER_DBPASS。按照RFC2396,你必须在连接字符串转义特殊字符,如:’:’,’/’,’+’和’@’。
在 “[DEFAULT]” 和 “[oslo_messaging_rabbit]”部分,配置 “RabbitMQ” 消息队列访问:
[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
用你在 “RabbitMQ” 中为 “openstack” 用户选择的密码替换 “RABBIT_PASS”。
在 “[DEFAULT]” 和 “[keystone_authtoken]” 部分,配置认证服务访问:
[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = ceilometer
password = CEILOMETER_PASS
用你在认证服务中为 “ceilometer” 选择的密码替换 “CEILOMETER_PASS”。
在 “[service_credentials]” 部分,配置服务证书:
[service_credentials]
...
os_auth_url = http://controller:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = CEILOMETER_PASS
os_endpoint_type = internalURL
os_region_name = RegionOne
用你在认证服务中为 “ceilometer” 选择的密码替换 “CEILOMETER_PASS”。
(可选的)为帮助排错,在 “[DEFAULT]”部分启用详细日志。
[DEFAULT]
...
verbose = True
启动Telemetry服务并将其配置为随系统启动:
# systemctl enable openstack-ceilometer-api.service \
openstack-ceilometer-notification.service \
openstack-ceilometer-central.service \
openstack-ceilometer-collector.service \
openstack-ceilometer-alarm-evaluator.service \
openstack-ceilometer-alarm-notifier.service
# systemctl start openstack-ceilometer-api.service \
openstack-ceilometer-notification.service \
openstack-ceilometer-central.service \
openstack-ceilometer-collector.service \
openstack-ceilometer-alarm-evaluator.service \
openstack-ceilometer-alarm-notifier.service
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.