Ceilometer项目创建时最初的目的是实现一个能为计费系统采集数据的框架。社区推动Ceilometer成为OpenStack里数据采集(监控数据、计费数据)的基础设施,采集到的数据提供给监控、计费、面板等项目使用
yum install openstack-ceilometer-api openstack-ceilometer-collector \
openstack-ceilometer-notification openstack-ceilometer-central \
openstack-ceilometer-alarm python-ceilometerclient -y
yum install mongodb-server mongodb -y
vi /etc/mongodb.conf
bind_ip = 0.0.0.0
启动mongodb服务
service mongod start
chkconfig mongod on
mongo --host controller --eval '
db = db.getSiblingDB("ceilometer");
db.addUser({user: "ceilometer",
pwd: "CEILOMETER_DBPASS",
roles: [ "readWrite", "dbAdmin" ]})'
openssl rand -hex 10
3e8bda4e13a68e966142 #记下此ID,下面配置文件需要用到
创建角色
keystone user-create --name=ceilometer --pass=CEILOMETER_PASS --email=ceilometer@example.com
keystone user-role-add --user=ceilometer --tenant=service --role=admin
编辑配置文件
vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
rpc_backend = ceilometer.openstack.common.rpc.impl_qpid
auth_strategy = keystone
[alarm]
[api]
[collector]
[database]
connection = mongodb://ceilometer:CEILOMETER_DBPASS@controller:27017/ceilometer
[dispatcher_file]
[event]
[keystone_authtoken]
admin_user = ceilometer
admin_tenant_name = service
auth_protocol = http
auth_uri = http://controller:5000
admin_password = CEILOMETER_PASS
auth_host = controller
[matchmaker_redis]
[matchmaker_ring]
[notification]
[publisher]
metering_secret = 3e8bda4e13a68e966142
[publisher_rpc]
[rpc_notifier2]
[service_credentials]
os_auth_url = http://controller:5000/v2.0
os_username = ceilometer
os_tenant_name = service
os_password = CEILOMETER_PASS
[ssl]
[vmware]
创建服务端点
keystone service-create --name=ceilometer --type=metering --description="Telemetry"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/ metering / {print $2}') \
--publicurl=http://controller:8777 \
--internalurl=http://controller:8777 \
--adminurl=http://controller:8777
启动服务
service openstack-ceilometer-api start
service openstack-ceilometer-notification start
service openstack-ceilometer-central start
service openstack-ceilometer-collector start
service openstack-ceilometer-alarm-evaluator start
service openstack-ceilometer-alarm-notifier start
chkconfig openstack-ceilometer-api on
chkconfig openstack-ceilometer-notification on
chkconfig openstack-ceilometer-central on
chkconfig openstack-ceilometer-collector on
chkconfig openstack-ceilometer-alarm-evaluator on
chkconfig openstack-ceilometer-alarm-notifier on
在controller控制节点上
openstack-config --set /etc/glance/glance-api.conf DEFAULT notification_driver messaging
openstack-config --set /etc/glance/glance-api.conf DEFAULT rpc_backend qpid
service openstack-glance-api restart
service openstack-glance-registry restart
在controller控制节点上
openstack-config --set /etc/cinder/cinder.conf DEFAULT control_exchange cinder
openstack-config --set /etc/cinder/cinder.conf \
DEFAULT notification_driver cinder.openstack.common.notifier.rpc_notifier
service openstack-cinder-api restart
service openstack-cinder-scheduler restart
service openstack-cinder-volume restart
在compute计算节点上
yum install openstack-ceilometer-compute python-ceilometerclient python-pecan -y
vi /etc/nova/nova.conf #添加一下配置,确保属于[DEFAULT]下
instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
notification_driver = nova.openstack.common.notifier.rpc_notifier
notification_driver = ceilometer.compute.nova_notifier
启动服务
service openstack-nova-compute restart
编辑配置文件
vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
qpid_hostname = controller
[alarm]
[api]
[collector]
[database]
[dispatcher_file]
[event]
[keystone_authtoken]
auth_host = controller
admin_user = ceilometer
admin_tenant_name = service
auth_protocol = http
admin_password = CEILOMETER_PASS
[matchmaker_redis]
[matchmaker_ring]
[notification]
[publisher]
metering_secret = 3e8bda4e13a68e966142
[publisher_rpc]
[rpc_notifier2]
[service_credentials]
os_username = ceilometer
os_tenant_name = service
os_password = CEILOMETER_PASS
os_auth_url = http://controller:5000/v2.0
[ssl]
[vmware]
启动服务
service openstack-ceilometer-compute start
chkconfig openstack-ceilometer-compute on
为指定的实例创建告警阀值为: 连续三次CPU使用率超过70%的时间持续10分钟
这里只有一个例子,可以根本业务需求来定制各种的Alarm
nova list | awk '/cirros-vol/{print $2}'
63e95b60-d4ab-4b52-8529-82b345083090
ceilometer alarm-threshold-create --name cpu_hi \
--description 'instance running hot' \ --meter-name cpu_util --threshold 70.0 \ --comparison-operator gt --statistic avg \ --period 600 --evaluation-periods 3 \ --alarm-action 'log://' \ --query resource_id=63e95b60-d4ab-4b52-8529-82b345083090 ceilometer alarm-list
重新Launch虚拟机,查看最新的Mem使用数据
ceilometer statistics -m memory -p 60