openstack ocata部署ceilometer+gnocchi

2018-02-11 14:07:15来源:oschina作者:CloudLeon人点击

分享
安装Gnocchi
先决条件
1. 完成以下步骤,创建数据库

使用 root 用户登录数据库


1
$ mysql -u root -p

创建 gnocchi 数据库


1
> CREATE DATABASE gnocchi;

配置 gnocchi 数据库权限(这里密码为 GNOCCHI_DBPASS,按需修改)


1
2
> GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'localhost' IDENTIFIED BY 'GNOCCHI_DBPASS';
> GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' IDENTIFIED BY 'GNOCCHI_DBPASS';

退出数据库

2. 加载 admin 用户认证文件

1
$ . admin-openrc

3. 完成以下步骤创建服务认证

创建 gnocchi 用户(用户密码为 GNOCCHI_PASS)


1
$ openstack user create --domain default --password-prompt gnocchi

为 gnocchi 用户增加 admin 的角色


1
$ openstack role add --project service --user gnocchi admin

创建 gnocchi 服务实体


1
$ openstack service create --name gnocchi --description "Metric Service" metric
创建 gnocchi 服务API endpoints
1
2
3
$ openstack endpoint create --region RegionOne metric public http://controller:8041
$ openstack endpoint create --region RegionOne metric internal http://controller:8041
$ openstack endpoint create --region RegionOne metric admin http://controller:8041
安装和配置组件
1. 安装软件包

1
# yum install openstack-gnocchi-api openstack-gnocchi-metricd python2-gnocchiclient -y

2. 编辑 /etc/gnocchi/gnocchi.conf 文件加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# /etc/gnocchi/gnocchi.conf
[DEFAULT]
log_dir = /var/log/gnocchi
[api]
auth_mode = keystone
[indexer]
url = mysql+pymysql://gnocchi:[email protected]/gnocchi
[storage]
driver = file
file_basepath = /var/lib/gnocchi
[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 = gnocchi
password = GNOCCHI_PASS

3. 新建 /etc/httpd/conf.d/10-gnocchi_wsgi.conf 文件,加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# vim /etc/httpd/conf.d/10-gnocchi_wsgi.conf
Listen 8041

ServerName controller
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/gnocchi"
## Directories, there should at least be a declaration for /var/www/cgi-bin/gnocchi

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted

## Logging
ErrorLog "/var/log/httpd/gnocchi_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/httpd/gnocchi_wsgi_access.log" combined
SetEnvIf X-Forwarded-Proto https HTTPS=1
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess gnocchi display-name=gnocchi_wsgi group=gnocchi processes=8 threads=8 user=gnocchi
WSGIProcessGroup gnocchi
WSGIScriptAlias / "/var/www/cgi-bin/gnocchi/app"


4. 复制 app.wsgi

1
2
3
# mkdir /var/www/cgi-bin/gnocchi/
# cp /usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi /var/www/cgi-bin/gnocchi/app
# chown -R gnocchi.gnocchi /var/www/cgi-bin/gnocchi

完成安装
1. 初始化数据库

1
# su -s /bin/bash gnocchi -c "gnocchi-upgrade"

2. 重启 httpd 以加载 gnocchi

1
# systemctl restart httpd

3. 启动服务并设置开机自启



1
2
# systemctl enable openstack-gnocchi-metricd
# systemctl start openstack-gnocchi-metricd

Telemetry 服务
Aodh 服务 (ceilometer节点)
先决条件
1. 完成以下步骤,创建数据库

使用 root 用户登录数据库


1
$ mysql -u root -p

创建 aodh 数据库


1
> CREATE DATABASE aodh;

配置 aodh 数据库权限(这里密码为 AODH_DBPASSWORD,按需修改)


1
2
> GRANT ALL PRIVILEGES ON aodh.* TO 'aodh'@'localhost' IDENTIFIED BY 'AODH_DBPASSWORD';
> GRANT ALL PRIVILEGES ON aodh.* TO 'aodh'@'%' IDENTIFIED BY 'AODH_DBPASSWORD';

退出数据库

2. 加载 admin 用户认证文件

1
$ . admin-openrc

3. 完成一下步骤创建服务认证

创建 aodh 用户(用户密码为 AODH_PASSWORD)


1
$ openstack user create --domain default --password-prompt aodh

为 aodh 用户增加 admin 的角色


1
$ openstack role add --project service --user aodh admin

创建 aodh 服务实体


1
$ openstack service create --name aodh --description "Telemetry" alarming
创建告警服务API endpoints
1
2
3
$ 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. 安装软件包

1
2
3
4
# yum install openstack-aodh-api /
openstack-aodh-evaluator openstack-aodh-notifier /
openstack-aodh-listener openstack-aodh-expirer /
python-aodhclient -y

2. 编辑 /etc/aodh/aodh.conf 文件加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# vim /etc/aodh/aodh.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone
[database]
connection = mysql+pymysql://aodh:[email protected]/aodh
[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_PASSWORD
[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_PASSWORD
interface = internalURL
region_name = RegionOne

3. 新建 /etc/httpd/conf.d/10-aodh_wsgi.conf 文件,加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# vim /etc/httpd/conf.d/10-aodh_wsgi.conf
Listen 8042

ServerName controller
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/aodh"
## Directories, there should at least be a declaration for /var/www/cgi-bin/aodh

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted

## Logging
ErrorLog "/var/log/httpd/aodh_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/httpd/aodh_wsgi_access.log" combined
SetEnvIf X-Forwarded-Proto https HTTPS=1
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess aodh display-name=aodh_wsgi group=aodh processes=2 threads=2 user=aodh
WSGIProcessGroup aodh
WSGIScriptAlias / "/var/www/cgi-bin/aodh/app"


4. 复制 app.wsgi

1
2
3
# mkdir /var/www/cgi-bin/aodh/
# cp /usr/lib/python2.7/site-packages/aodh/api/app.wsgi /var/www/cgi-bin/aodh/app
# chown -R aodh.aodh /var/www/cgi-bin/aodh

完成安装
1. 初始化数据库(仅当使用 SQL 数据库的时候才需要初始化)

1
# aodh-dbsync

2. 重启 httpd 以加载 aodh

1
# systemctl restart httpd

3. 启动服务并设置开机自启(任一控制节点执行)

1
2
# systemctl enable openstack-aodh-evaluator.service openstack-aodh-notifier.service openstack-aodh-listener.service
# systemctl start openstack-aodh-evaluator.service openstack-aodh-notifier.service openstack-aodh-listener.service

Panko 服务 (ceilometer节点)
先决条件
1. 完成以下步骤,创建数据库

使用 root 用户登录数据库


1
$ mysql -u root -p

创建 panko 数据库


1
> CREATE DATABASE panko;

配置 panko 数据库权限(数据库密码为 e0ee97b87b0be41b5ba0 )


1
2
> GRANT ALL PRIVILEGES ON aodh.* TO 'panko'@'localhost' IDENTIFIED BY 'e0ee97b87b0be41b5ba0';
> GRANT ALL PRIVILEGES ON aodh.* TO 'panko'@'%' IDENTIFIED BY 'e0ee97b87b0be41b5ba0';

退出数据库

2. 加载 admin 用户认证文件

1
$ . admin-openrc

3. 完成一下步骤创建服务认证

创建 panko 用户(用户密码为 PANKO_PASSWORD)


1
$ openstack user create --domain default --password-prompt panko

为 panko 用户增加 admin 的角色


1
$ openstack role add --project service --user panko admin

创建 panko 服务实体


1
$ openstack service create --name panko --description "OpenStack Event Service" event
4. 创建Event服务API endpoints

1
2
3
$ openstack endpoint create --region RegionOne event public http://controller:8779
$ openstack endpoint create --region RegionOne event internal http://controller:8779
$ openstack endpoint create --region RegionOne event admin http://controller:8779

安装和配置组件
1. 安装软件包

1
# yum install openstack-panko-api openstack-panko-common -y

2. 编辑 /etc/panko/panko.conf 文件加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# vim /etc/panko/panko.conf
[DEFAULT]
auth_strategy = keystone
log_file = /var/log/panko/panko.log
log_dir = /var/log/panko
[api]
host=0.0.0.0
port=8779
workers=2
max_limit=1000
[database]
connection = mysql+pymysql://panko:[email protected]/panko
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = panko
password = PANKO_PASSWORD

3. 新建 vim /etc/httpd/conf.d/10-panko_wsgi.conf 文件,加入以下内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Listen 8779

ServerName controller
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/panko"
## Directories, there should at least be a declaration for /var/www/cgi-bin/panko

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted

## Logging
ErrorLog "/var/log/httpd/panko_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/httpd/panko_wsgi_access.log" combined
SetEnvIf X-Forwarded-Proto https HTTPS=1
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess panko display-name=panko_wsgi group=panko processes=2 threads=2 user=panko
WSGIProcessGroup panko
WSGIScriptAlias / "/var/www/cgi-bin/panko/app"


4. 复制 app.wsgi

1
2
3
# mkdir /var/www/cgi-bin/panko/
# cp /usr/lib/python2.7/site-packages/panko/api/app.wsgi /var/www/cgi-bin/panko/app
# chown -R panko.panko /var/www/cgi-bin/panko/

5. 初始化数据

1
# /usr/bin/panko-dbsync

完成安装

重启 httpd 以加载 panko



1
# systemctl restart httpd


Ceilometer服务
安装和配置控制节点 (ceilometer节点)
Ceilometer

先决条件


1. 加载 admin 认证文件



1
$ . admin-openrc

2. 创建服务认证,完成以下步骤

创建ceilemeter用户(用户密码为 CEILOMETER_PASSWORD)


1
$ openstack user create --domain default --password-prompt ceilometer

给ceilometer用户增加admin的角色


1
$ openstack role add --project service --user ceilometer admin

创建ceilometer服务实体


1
$ openstack service create --name ceilometer --description "Telemetry" metering

创建 Telemetry 服务 API endpoint


1
2
3
$ 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. 安装软件包



1
2
3
# yum install openstack-ceilometer-api /
openstack-ceilometer-collector openstack-ceilometer-notification /
openstack-ceilometer-central python-ceilometerclient-y

2. 编辑 /etc/ceilometer/ceilometer.conf 文件加入以下内容



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# vim /etc/ceilometer/ceilometer.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone
meter_dispatchers=gnocchi
event_dispatchers=panko
[dispatcher_gnocchi]
filter_service_activity = False
archive_policy = high
resources_definition_file=gnocchi_resources.yaml
url=http://controller:8041
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = ceilometer
password = CEILOMETER_PASSWORD
service_token_roles_required = True
[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_PASSWORD
interface = internalURL
region_name = RegionOne

3. 新建 /etc/httpd/conf.d/10-ceilometer_wsgi.conf 文件,加入以下内容



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# vim /etc/httpd/conf.d/10-ceilometer_wsgi.conf
Listen 8777

ServerName controller
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/ceilometer"
## Directories, there should at least be a declaration for /var/www/cgi-bin/ceilometer

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted

## Logging
ErrorLog "/var/log/httpd/ceilometer_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/httpd/ceilometer_wsgi_access.log" combined
SetEnvIf X-Forwarded-Proto https HTTPS=1
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess ceilometer display-name=ceilometer_wsgi group=ceilometer processes=1 threads=2 user=ceilometer
WSGIProcessGroup ceilometer
WSGIScriptAlias / "/var/www/cgi-bin/ceilometer/app"


4. 复制 app.wsgi



1
2
3
# mkdir /var/www/cgi-bin/ceilometer/
# cp /usr/lib/python2.7/site-packages/ceilometer/api/app.wsgi /var/www/cgi-bin/ceilometer/app
# chown -R ceilometer.ceilometer /var/www/cgi-bin/ceilometer/


运行一下命令在gnocchi中创建ceilometer的资源


1
# ceilometer-upgrade --skip-metering-database

完成安装


1. 重启 httpd 以加载 ceilometer



1
# systemctl restart httpd

2. 启动服务并设置开机自启



1
2
3
4
5
6
# systemctl enable openstack-ceilometer-notification.service /
openstack-ceilometer-central.service /
openstack-ceilometer-collector.service
# systemctl start openstack-ceilometer-notification.service /
openstack-ceilometer-central.service /
openstack-ceilometer-collector.service

安装和配置计算节点 (计算节点)
安装并配置组件

1. 安装软件包



1
# yum install openstack-ceilometer-compute python2-wsme

2. 编辑 /etc/ceilometer/ceilometer.conf 文件加入已下内容



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# vim /etc/ceilometer/ceilometer.conf
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
auth_strategy = keystone
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller01:11211,controller02:11211,controller03:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = ceilometer
password = CEILOMETER_PASSWORD
[service_credentials]
auth_url = http://controller:5000
project_domain_id = default
user_domain_id = default
auth_type = password
username = ceilometer
project_name = service
password = CEILOMETER_PASSWORD
interface = internalURL
region_name = RegionOne

配置计算节点使用Telemetry

编辑 /etc/nova/nova.conf 加入以下内容



1
2
3
4
5
6
7
8
# 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


完成安装

1. 启动agent并设置开机自启



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

2. 重启计算服务



1
# systemctl restart openstack-nova-compute.service

配置 opesntack 服务以支持ceilometer (控制节点)
Cinder
1. 配置cinder使用telemetry

编辑/etc/cinder/cinder.conf文件加入以下内容



1
2
[oslo_messaging_notifications]
driver = messagingv2

2. 通过定时任务获取阶段性的通知,例如没5分钟执行一次

1
2
3
# crontab -e
*/5 * * * * /usr/bin/cinder-volume-usage-audit --send_actions

3. 重启服务

1
# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service openstack-cinder-volume.service

Glance
1. 配置镜像服务使用telemetry

编辑/etc/glance/glance-api.conf 和 /etc/glance/glance-registry.conf



1
2
3
4
5
[DEFAULT]
transport_url = rabbit://openstack:[email protected]
[oslo_messaging_notifications]
driver = messagingv2

2. 重启服务

1
# systemctl restart openstack-glance-api.service openstack-glance-registry.service

Neutron
1. 配置网络服务使用telemetry

编辑 /etc/neutron/neutron.conf 文件加入以下内容



1
2
[oslo_messaging_notifications]
driver = messagingv2


2. 重启服务

1
# systemctl restart neutron-server.service

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台