Telemetry服务 — 安装和配置:
控制节点操作:
先决条件:
1、如下操作。
# mongo --host controller --eval ‘ db = db.getSiblingDB("ceilometer"); db.createUser({user: "ceilometer", pwd: "CEILOMETER_DBPASS", roles: [ "readWrite", "dbAdmin" ]})‘ MongoDB shell version: 2.6.11 connecting to: controller:27017/test Successfully added user: { "user" : "ceilometer", "roles" : [ "readWrite", "dbAdmin" ] } ############################################################################################# # . admin-openrc # openstack user create --domain default --password-prompt ceilometer # openstack role add --project service --user ceilometer admin # openstack service create --name ceilometer --description "Telemetry" metering # openstack endpoint create --region RegionOne metering public http://controller:8777 # openstack endpoint create --region RegionOne metering internal http://controller:8777 # openstack endpoint create --region RegionOne metering admin http://controller:8777
安装并配置组件:
1、安装包。
# yum install -y openstack-ceilometer-api openstack-ceilometer-collector openstack-ceilometer-notification openstack-ceilometer-central python-ceilometerclient
2、编辑 /etc/ceilometer/ceilometer.conf 文件。
[database] connection = mongodb://ceilometer:CEILOMETER_DBPASS@controller:27017/ceilometer [DEFAULT] rpc_backend = rabbit auth_strategy = keystone [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = ceilometer password = CEILOMETER_PASS [service_credentials] auth_type = password auth_url = http://controller:5000/v3 project_domain_name = default user_domain_name = default project_name = service username = ceilometer password = CEILOMETER_PASS interface = internalURL region_name = RegionOne
3、启动Telemetry服务并配置为随系统启动。
# systemctl enable openstack-ceilometer-api openstack-ceilometer-notification openstack-ceilometer-central openstack-ceilometer-collector # systemctl start openstack-ceilometer-api openstack-ceilometer-notification openstack-ceilometer-central openstack-ceilometer-collector
Telemetry服务 — 启用镜像服务计量:
控制节点操作:
配置镜像服务使用Telemetry:
1、编辑 /etc/glance/glance-api.conf 文件和 /etc/glance/glance-registry.conf 文件。
[DEFAULT] rpc_backend = rabbit [oslo_messaging_notifications] driver = messagingv2 [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS
2、重启镜像服务。
# systemctl restart openstack-glance-api openstack-glance-registry
Telemetry服务 — 启用计算服务计量:
计算节点操作:
安装并配置组件:
1、安装包。
# yum install -y openstack-ceilometer-compute python-ceilometerclient python-pecan
2、编辑 /etc/ceilometer/ceilometer.conf 文件。
[DEFAULT] rpc_backend = rabbit auth_strategy = keystone [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = ceilometer password = CEILOMETER_PASS [service_credentials] auth_type = password auth_url = http://controller:5000/v3 project_domain_name = default user_domain_name = default project_name = service username = ceilometer password = CEILOMETER_PASS interface = internalURL region_name = RegionOne
3、编辑 /etc/nova/nova.conf 文件。
[DEFAULT] instance_usage_audit = True instance_usage_audit_period = hour notify_on_state_change = vm_and_task_state notification_driver = messagingv2
4、启动代理并配置随系统启动。
# systemctl enable openstack-ceilometer-compute # systemctl start openstack-ceilometer-compute
5、重启计算服务。
# systemctl restart openstack-nova-compute
Telemetry服务 — 启用计算服务计量:
控制节点和存储节点操作:
配置卷使用Telemetry:
1、编辑 /etc/cinder/cinder.conf 文件。
[oslo_messaging_notifications]
driver = messagingv2
2、重启控制节点上的块设备存储服务。
# systemctl restart openstack-cinder-api openstack-cinder-scheduler
3、重启存储节点上的块设备存储服务。
# systemctl restart openstack-cinder-volume
Telemetry服务 — 启用对象计量:
控制节点操作:
先决条件:
1、如下操作。
# . admin-openrc # openstack role create ResellerAdmin # openstack role add --project service --user ceilometer ResellerAdmin # yum install -y python-ceilometermiddleware
配置对象存储使用Telemetry:
1、编辑 /etc/swift/proxy-server.conf 文件。
[filter:keystoneauth] operator_roles = admin, user, ResellerAdmin [pipeline:main] pipeline = ceilometer catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server [filter:ceilometer] paste.filter_factory = ceilometermiddleware.swift:filter_factory control_exchange = swift url = rabbit://openstack:RABBIT_PASS@controller:5672/ driver = messagingv2 topic = notifications log_level = WARN
2、重启对象存储的代理服务。
# systemctl restart openstack-swift-proxy
Telemetry服务 — 告警服务:
控制节点操作:
先决条件:
1、如下操作。
# mysql -u root -p*** > CREATE DATABASE aodh; > GRANT ALL PRIVILEGES ON aodh.* TO ‘aodh‘@‘localhost‘ IDENTIFIED BY ‘AODH_DBPASS‘; > GRANT ALL PRIVILEGES ON aodh.* TO ‘aodh‘@‘%‘ IDENTIFIED BY ‘AODH_DBPASS‘; > exit; # . admin-openrc # openstack user create --domain default --password-prompt aodh # openstack role add --project service --user aodh admin # openstack service create --name aodh --description "Telemetry" alarming # openstack endpoint create --region RegionOne alarming public http://controller:8042 # openstack endpoint create --region RegionOne alarming internal http://controller:8042 # openstack endpoint create --region RegionOne alarming admin http://controller:8042
安装并配置组件:
1、安装包。
# yum install -y openstack-aodh-api openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener openstack-aodh-expirer python-ceilometerclient
2、编辑 /etc/aodh/aodh.conf 文件。
[database] connection = mysql+pymysql://aodh:AODH_DBPASS@controller/aodh [DEFAULT] rpc_backend = rabbit auth_strategy = keystone [oslo_messaging_rabbit] rabbit_host = controller rabbit_userid = openstack rabbit_password = RABBIT_PASS [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = aodh password = AODH_PASS [service_credentials] auth_type = password auth_url = http://controller:5000/v3 project_domain_name = default user_domain_name = default project_name = service username = aodh password = AODH_PASS interface = internalURL region_name = RegionOne
3、初始化告警数据库并验证。
# su -s /bin/sh -c "aodh-dbsync" aodh # mysql -uaodh -pAODH_DBPASS -hcontroller -t aodh -e "show tables"
4、启动Alarming服务并配置随系统启动。
# systemctl enable openstack-aodh-api openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener # systemctl start openstack-aodh-api openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener
Telemetry服务 — 验证操作:
控制节点操作:
1、获得 admin 凭证来获取只有管理员能执行的命令的访问权限。
# . admin-openrc
2、列出可用的 meters。
# ceilometer meter-list +---------------------------------+-------+-----------+---------------------------------------------+---------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------------------+-------+-----------+---------------------------------------------+---------+----------------------------------+ | image | gauge | image | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | None | 56add7178d9b4309ba55aae10c8b9a08 | | image.size | gauge | B | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.containers.objects | gauge | object | 2b3346f2bb59463ea523d753f892403c/container1 | None | 2b3346f2bb59463ea523d753f892403c | | storage.containers.objects.size | gauge | B | 2b3346f2bb59463ea523d753f892403c/container1 | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects | gauge | object | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects | gauge | object | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects | gauge | object | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.containers | gauge | container | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.containers | gauge | container | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.containers | gauge | container | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.outgoing.bytes | delta | B | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.outgoing.bytes | delta | B | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.outgoing.bytes | delta | B | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.size | gauge | B | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.size | gauge | B | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.size | gauge | B | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | +---------------------------------+-------+-----------+---------------------------------------------+---------+----------------------------------+
3、从镜像服务下载CirrOS镜像。
# IMAGE_ID=$(glance image-list | grep ‘cirros‘ | awk ‘{ print $2 }‘) # glance image-download $IMAGE_ID > /tmp/cirros.img
4、再次列出可用的 meters 以验证镜像下载的检查。
# ceilometer meter-list +---------------------------------+-------+-----------+---------------------------------------------+----------------------------------+----------------------------------+ | Name | Type | Unit | Resource ID | User ID | Project ID | +---------------------------------+-------+-----------+---------------------------------------------+----------------------------------+----------------------------------+ | image | gauge | image | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | 53e34601673f4d84bc52fed61511019d | 56add7178d9b4309ba55aae10c8b9a08 | | image.download | delta | B | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | 53e34601673f4d84bc52fed61511019d | 56add7178d9b4309ba55aae10c8b9a08 | | image.serve | delta | B | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | 53e34601673f4d84bc52fed61511019d | 56add7178d9b4309ba55aae10c8b9a08 | | image.size | gauge | B | e3944bd5-1ac1-48b3-8fdf-2071f2a3b2a1 | 53e34601673f4d84bc52fed61511019d | 56add7178d9b4309ba55aae10c8b9a08 | | storage.containers.objects | gauge | object | 2b3346f2bb59463ea523d753f892403c/container1 | None | 2b3346f2bb59463ea523d753f892403c | | storage.containers.objects.size | gauge | B | 2b3346f2bb59463ea523d753f892403c/container1 | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects | gauge | object | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects | gauge | object | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects | gauge | object | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.containers | gauge | container | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.containers | gauge | container | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.containers | gauge | container | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.outgoing.bytes | delta | B | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.outgoing.bytes | delta | B | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.outgoing.bytes | delta | B | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | | storage.objects.size | gauge | B | 1e6b9ff79a49443b806b5876b125e8db | None | 1e6b9ff79a49443b806b5876b125e8db | | storage.objects.size | gauge | B | 2b3346f2bb59463ea523d753f892403c | None | 2b3346f2bb59463ea523d753f892403c | | storage.objects.size | gauge | B | 56add7178d9b4309ba55aae10c8b9a08 | None | 56add7178d9b4309ba55aae10c8b9a08 | +---------------------------------+-------+-----------+---------------------------------------------+----------------------------------+----------------------------------+
5、从 image.download 表读取使用量统计值。
# ceilometer statistics -m image.download -p 60 +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+ | Period | Period Start | Period End | Max | Min | Avg | Sum | Count | Duration | Duration Start | Duration End | +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+ | 60 | 2018-03-28T04:24:31.599000 | 2018-03-28T04:25:31.599000 | 13287936.0 | 13287936.0 | 13287936.0 | 13287936.0 | 1 | 0.0 | 2018-03-28T04:24:35.888000 | 2018-03-28T04:24:35.888000 | +--------+----------------------------+----------------------------+------------+------------+------------+------------+-------+----------+----------------------------+----------------------------+
6、删除之前下载的镜像文件 /tmp/cirros.img。
# rm /tmp/cirros.img