当前位置: 首页 > 工具软件 > Ceilometer > 使用案例 >

openstack/ceilometer手动安装

谷越
2023-12-01

#该篇文章基于Queens同时基于All-in-one开发,下面创建的项目都是同一ip,同一个项目,同时密码也是基于自动部署的密码,所以详细内容请看官方文档.下一篇自动部署会

attention:ladys and Gentlemen,this is impotant.
kenstone操作基本每次都需要做

source keystone_admin或者admin_pre
vim keystone_admin(这是重点)

unset OS_SERVICE_TOKEN
    export OS_USERNAME=admin
    export OS_PASSWORD='admin'
    export OS_AUTH_URL=http://192.168.1.90:5000/v3
    export PS1='[\u@\h \W(keystone_admin)]\$ '

export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_TYPE=password
export OS_REGION_NAME=RegionOne

####一.现在做的操作都在计算节点操作,#这里的ip地址都为controler
1)下载ceilometer
# yum install openstack-ceilometer-compute
2)编辑文件:
vim /etc/ceilometer/ceilometer.conf

[DEFAULT]

transport_url = rabbit://guest:guest@192.168.1.90

[service_credentials]

auth_url = http://192.168.1.90:5000
project_domain_id = default
user_domain_id = default
auth_type = password
username = 192.168.1.90
project_name = services
password = admin
interface = internalURL
region_name = RegionOne

vim /etc/nova/nova.conf

[DEFAULT]
instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
[oslo_messaging_notifications]

driver = messagingv2

启动代理并且自启

#systemctl enable openstack-ceilometer-compute.service
#systemctl start openstack-ceilometer-compute.service

重启计算节点:

#systemctl restart openstack-nova-compute.service

####二.配置文件
1.加载admin配置文件
$ . admin-openrc
2.创建ceilometer用户
$ openstack user create --domain default --password-prompt ceilometer
3.为ceilomer增加admin角色
$ openstack role add --project services --user ceilometer admin
$ openstack role add --project admin --user ceilometer admin
4.在Keystone注册Gnocchi服务:
-创建gnocchi用户:
$ openstack user create --domain default --password-prompt gnocchi
-创建gnocchi服务实体:
$ openstack service create --name gnocchi --description "Metric Service" metric
-将admin角色添加到gnocchi用户
$ openstack role add --project services --user gnocchi admin
$ openstack role add --project admin --user gnocchi admin
-创建Metric服务端口
openstack endpoint create --region RegionOne metric public http://192.168.1.90:8041
openstack endpoint create --region RegionOne metric internal http://192.168.1.90:8041
openstack endpoint create --region RegionOne metric admin http://192.168.1.90:8041

####三.安装 Gnocchi
1.安装
yum install openstack-gnocchi-api openstack-gnocchi-metricd python-gnocchiclient -y
2.为Gnocchi的索引器创建数据库:
$ mysql -u root -p
CREATE DATABASE gnocchi;
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'192.168.1.90' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' IDENTIFIED BY 'admin';

3.vim /etc/gnocchi/gnocchi.conf

 [api]
auth_mode = keystone

[keystone_authtoken]

auth_type = password
www_authenticate_uri = http://192.168.1.90:5000/v3
auth_url = http://192.168.1.90:5000/v3
memcached_servers = 192.168.1.90:11211
project_domain_name = Default
user_domain_name = Default
project_name = services
username = gnocchi
password = admin
interface = internalURL
region_name = RegionOne
auth_version = 3
auth_port = 35357


[indexer]
url = mysql+pymysql://gnocchi:admin@192.168.1.90/gnocchi

[storage]

coordination_url = redis://192.168.1.90:6379
file_basepath = /var/lib/gnocchi
driver = file

4.初始化Gnocchi:
gnocchi-upgrade

5.启动Gnocchi服务并将其配置为在系统引导时启动:
# systemctl enable openstack-gnocchi-api.service openstack-gnocchi-metricd.service
# systemctl start openstack-gnocchi-api.service openstack-gnocchi-metricd.service
6.安装Ceilometer包:
# yum install openstack-ceilometer-notification openstack-ceilometer-central -y
7.vim /etc/ceilometer/pipeline.yaml

publishers:
    # set address of Gnocchi
    # + filter out Gnocchi-related activity meters (Swift driver)
    # + set default archive policy
    - gnocchi://?filter_project=services&archive_policy=low

8.vim /etc/ceilometer/ceilometer.conf

[DEFAULT]
...
transport_url = rabbit://guest:guest@192.168.1.90

[keystone_authtoken]
www_authenticate_uri = http://192.168.1.90:5000/v3
auth_url = http://192.168.1.90:35357/v3
memcached_servers = 192.168.1.90:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = services
username = gnocchi
password = admin
interface = internalURL
region_name = RegionOne

[service_credentials]

auth_type = password
www_authenticate_uri = http://192.168.1.90:5000/v3
auth_url = http://192.168.1.90:5000/v3
memcached_servers = 192.168.1.90:11211
project_domain_id = default
user_domain_id = default
project_name = services
username = 192.168.1.90
password = admin
interface = internalURL
region_name = RegionOne

9.在gnocchi运行ceilomerter
# ceilometer-upgrade
10.自启服务
# systemctl enable openstack-ceilometer-notification.service openstack-ceilometer-central.service
# systemctl start openstack-ceilometer-notification.service openstack-ceilometer-central.service

11.gnocchi status(这里验证一下,后面的验证就没问题了)

####四.下面都是在不同的组件中进行配置,cinder
1.vim /etc/cinder/cinder.conf

[oslo_messaging_notifications] 

driver  =  messagingv2

#######收集数据时间
$ cinder-volume-usage-audit --start_time = '* / 5 * * * * / path / to / cinder' - volume - usage - audit - send_actions

2.控制节点和存储结点重启快存储
# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl restart openstack-cinder-volume.service

####五.在Glance修改配置
1.vim /etc/glance/glance-api.conf and /etc/glance/glance-registry.conf

[DEFAULT]

transport_url = rabbit://guest:guest@192.168.1.90

[oslo_messaging_notifications]

driver = messagingv2

2.重启镜像服务
# systemctl restart openstack-glance-api.service openstack-glance-registry.service

####六.在Heat修改配置
1.vim /etc/heat/heat.conf

[oslo_messaging_notifications]

driver = messagingv2

2.重启Orchestration
# systemctl restart openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service

####七.在Neutron修改配置
1.vim /etc/neutron/neutron.conf

[oslo_messaging_notifications]
...
driver = messagingv2

2.重启网路
# systemctl restart neutron-server.service

####八.在Swift修改配置(这部分一般都没有安装)
1.加载admin配置文件
$ . admin-openrc
$ openstack role create ResellerAdmin
$ openstack role add --project services --user ceilometer ResellerAdmin
$ openstack role add --project admin --user ceilometer ResellerAdmin
# yum install python-ceilometermiddleware

2.vim /etc/swift/proxy-server.conf

[filter:keystoneauth]
...
operator_roles = admin, user, ResellerAdmin
[pipeline:main]
pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging ceilometer 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

3.重新启动对象存储代理服务:
# systemctl restart openstack-swift-proxy.service

####九.验证操作
1.加载admin配置文件
$ . admin-openrc
$ gnocchi resource list --type image
$ gnocchi resource show a6b387e1-4276-43db-b17a-e10f649d85a3
2.从Image服务下载CirrOS映像:
$ IMAGE_ID=$(glance image-list | grep 'cirros' | awk '{ print $2 }')
$ glance image-download $IMAGE_ID > /tmp/cirros.img
$ gnocchi measures show 839afa02-1668-4922-a33e-6b6ea7780715
$ rm /tmp/cirros.img

 类似资料: