Monasca安装配置指导(2/3) – 安装api、agent、persister

云计算 waitig 600℃ 百度已收录 0评论

Monasca安装配置指导(2/3) – 安装api、agent、persister


作者:张航东
OpenStack版本:Newton
Linux:CentOS 7
本文主要用于个人学习、总结,欢迎转载,但请务必注明作者和出处,感谢!


4 monasca-api

2.1 安装

#git clone https://github.com/openstack/monasca-api.git
#cd monasca-api
#python setup.py install

2.2 配置

2.2.1 Keystone相关配置

1> 创建monasca用户

#openstack user create –domain default –password-prompt monasca
#openstack role add –project service –user monasca admin

2> 创建monasca服务

#openstack service create –name monasca –description “This is monasca service” monitoring

3> 创建endpoint

#openstack endpoint create –region RegionOne monitoring public http://10.127.2.121:8070/v2.0

#openstack endpoint create –region RegionOne monitoring internal http://10.127.2.121:8070/v2.0

#openstack endpoint create –region RegionOne monitoring admin http://10.127.2.121:8070/v2.0

2.2.2 Wsgi相关配置

在/etc/httpd/conf.d/目录下,创建wsgi-monasca.conf文件,并添加如下内容:

Listen 10.127.2.121:8070
< VirtualHost *:8070>
WSGIDaemonProcess monasca_api processes=2 threads=4 user=monasca display-name=%{GROUP}
WSGIProcessGroup monasca_api
WSGIScriptAlias / /usr/lib/python2.7/site-packages/monasca_api/api/wsgi.py
WSGIApplicationGroup %{GLOBAL}
< Directory /usr/lib/python2.7/site-packages/monasca_api>
Require all granted
< /Directory>

ErrorLog /var/log/monasca/api/wsgi.log
CustomLog /var/log/monasca/api/wsgi-access.log combined
< /VirtualHost>

WSGISocketPrefix /var/run/httpd

2.2.3 Monasca配置

创建Monasca日志目录

#mkdir /var/log/monasca
#mkdir /var/log/monasca/api
#touch /var/log/monasca/api/monasca-api.log

在 /etc/monasca/api-config.conf文件内添加如下内容:

[DEFAULT]
region = RegionOne

[security]
default_authorized_roles = admin
agent_authorized_roles = admin, user
read_only_authorized_roles =admin, user
delegate_authorized_roles = admin

[kafka]
uri = 127.0.0.1

[influxdb]
ip_address = 127.0.0.1
port = 8086
user = monasca
password = monasca
database_name = monasca

[database]
connection = mysql+pymysql://monasca:monasca@10.127.2.121/monasca?charset=utf8mb4

[keystone_authtoken]
auth_uri = http://10.127.2.121:5000
auth_url = http://10.127.2.121:35357
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = monasca
password = monasca
insecure=false

2.2.4 Mysql 数据库配置

进入Mysql:

#mysql -u root -p

依次执行以下连接中的数据库命令:
https://github.com/openstack/openstack-ansible-os_monasca/blob/master/templates/mon_mysql.sql.j2


5 monasca-agent

(参考:https://github.com/openstack/monasca-agent/blob/master/docs/Agent.md)

5.1 安装

#pip install monasca-agent

5.2 启动

#monasca-setup –username adminpassword 123456project_name adminproject_domain_id 9f95b9967b894c928880feb32fad1d0duser_domain_id 9f95b9967b894c928880feb32fad1d0dkeystone_url http://10.127.2.121:35357/v3 –system_only

PS:黑色粗体为keystone鉴权需要的参数,根据实际情况替换后面红色部分。另外,在启动后,可能会出现服务启动失败的情况,日志中会显示问题(大多是依赖包版本问题),根据情况修正即可。


6 monasca-persister

6.1 安装

#git clone https://github.com/openstack/monasca-persister.git
#cd monasca-persister
#python setup.py install

6.2 配置

创建persister日志目录

#mkdir /var/log/monasca/persister
#touch /var/log/monasca/persister/persister.log

修改配置文件 /etc/monasca/persister.conf,内添加如下内容:

[zookeeper]
uri = 127.0.0.1:2181

[kafka_alarm_history]
uri = 127.0.0.1:9092

[kafka_metrics]
uri = 127.0.0.1:9092

[influxdb]
database_name = monasca
ip_address = 127.0.0.1
port = 8086
user = monasca
password = monasca

6.3 启动

#monasca-persister


本文由【waitig】发表在等英博客
本文固定链接:Monasca安装配置指导(2/3) – 安装api、agent、persister
欢迎关注本站官方公众号,每日都有干货分享!
等英博客官方公众号
点赞 (0)分享 (0)