Ceilometer + Gnocchi + Aodh
本处主要讲述Gnocchi 的安装及配置,其它Module的安装可以参考 http://docs.openstack.org/mitaka/install-guide-rdo/
部署环境
系统版本: CentOS7
Openstack版本: Mitaka
1.创建Gnocchi的数据库
1 CREATE DATABASE gnocchi; 2 GRANT ALL PRIVILEGES ON gnocchi.* TO '$USERNAME'@'localhost' IDENTIFIED BY '$PASSOWRD'; 3 GRANT ALL PRIVILEGES ON gnocchi.* TO '$USERNAME'@'%' IDENTIFIED BY '$PASSOWRD';
2.控制节点安装Gnocchi
1 sudo yum install openstack-gnocchi-api openstack-gnocchi-metricd openstack-gnocchi-statsd
3.创建Username及Service
1 openstack user create --domain default --password-prompt gnocchi 2 openstack role add --project service --user gnocchi admin 3 4 openstack service create --name gnocchi --description "OpenStack Metric" metric 5 openstack endpoint create --region RegionOne metric public http://$CONTROLLER_IP:8041 6 openstack endpoint create --region RegionOne metric admin http://$CONTROLLER_IP:8041 7 openstack endpoint create --region RegionOne metric internal http://$CONTROLLER_IP:8041
4. 配置Gnocchi
1 vim /etc/gnocchi/gnocchi.conf 2 3 [database] 4 backend = sqlalchemy #配置存储index的数据库类型 5 6 7 [indexer] 8 url = mysql+pymysql://$USERNAME:$PASSWORD@$CONTROLLER_ip/gnocchi 9 10 11 [keystone_authtoken] #配置gnocchi服务的权限信息 12 auth_uri = http://$CONTROLLER_IP:5000/v3 13 identity_uri = http://$CONTROLLER_IP:35357/ 14 admin_user = $USERNAME 15 admin_password = $PASSWORD 16 admin_tenant_name = service 17 signing_dir = /var/cache/gnocchi 18 19 20 [statsd] #配置gnocchi服务的标识信息(忽略Gnocchi的采样数据),Gnocchi服务相关的信息 21 resource_id = 22 user_id = 23 project_id = 24 archive_policy_name = low 25 26 27 [storage] #配置storage的后端driver,默认是file 28 coordination_url = file:///var/lib/gnocchi/locks 29 driver = file 30 file_basepath = /var/lib/gnocchi 31 32 --------------------------------------------------------------------------------------------------- 33 vim /etc/gnocchi/api-paste.ini 34 35 [pipeline:main] #鉴权请求,否则无法执行policy.conf指定admin的操作 36 pipeline = gnocchi+auth 37 38 #创建gnocchi服务需要的目录 39 mkdir /var/cache/gnocchi && chown gnocchi:gnocchi -R /var/cache/gnocchi 40 mkdir /var/lib/gnocchi && chown gnocchi:gnocchi -R /var/lib/gnocchi
5.初始化Gnocchi 服务的数据库
1 gnocchi-upgrade
6.启动Gnocchi服务
1 systemctl enable openstack-gnocchi-api.service openstack-gnocchi-metricd.service openstack-gnocchi-statsd.service 2 3 systemctl start openstack-gnocchi-api.service openstack-gnocchi-metricd.service openstack-gnocchi-statsd.service 4 #Mitaka版本初始化数据库时,并创建默认的archive-policy https://review.openstack.org/#/c/290626/ 5 gnocchi archive-policy create -d granularity:5m,points:12 -d granularity:1h,points:24 -d granularity:1d,points:30 low 6 gnocchi archive-policy create -d granularity:60s,points:60 -d granularity:1h,points:168 -d granularity:1d,points:365 medium 7 gnocchi archive-policy create -d granularity:1s,points:86400 -d granularity:1m,points:43200 -d granularity:1h,points:8760 high 8 gnocchi archive-policy-rule create -a low -m "*" default
7.修改Ceilometer配置文件
1 vim /etc/ceilometer/ceilometer.conf 2 3 [DEFAULT] 4 meter_dispatchers = gnocchi 5 6 [api] 7 gnocchi_is_enabled = true 8 9 [dispatcher_gnocchi] 10 filter_project = service 11 filter_service_activity = True 12 url = http://$CONTROLLER_IP:8041
8.重启Ceilometer服务
1 systemctl restart openstack-ceilometer-api.service openstack-ceilometer-collector.service openstack-ceilometer-notification.service
9.示例
创建Ceilometer告警
1 gnocchi metric list 2 gnocchi resource list 3 4 5 ceilometer alarm-gnocchi-resources-threshold-create --name gnocchi_test_network --description 'storage.objects.containers' --alarm-action 'log://' --evaluation-periods 2 \ 6 --aggregation-method max --comparison-operator gt --threshold 5871354.0 -m network.incoming.bytes --resource-type instance_network_interface \ 7 --resource-id addbb3ba-5b1e-543f-ba8a-1010e5d36dbc --repeat-actions true
10.参考文档
http://www.cnblogs.com/knitmesh/p/5464709.html
https://www.ustack.com/blog/telemetry/
http://docs.openstack.org/developer/gnocchi/rest.html#archive-policy
https://julien.danjou.info/blog/2014/openstack-ceilometer-the-gnocchi-experiment