在控制节点上执行
#!/bin/bash
MYSQL_ROOT_PASSWD='m4r!adbOP'
GNOCCHI_PASSWD='gnocchi1234!'
CEILOMETER_PASSWD='ceilometer1234!'
RABBIT_PASSWD='0penstackRMQ'
AODH_PASSWD='aodh1234!'
controllerHost='controller'
OPENSTACK_RELEASE='queens'
controller-aodh(){
mysql -uroot -p${MYSQL_ROOT_PASSWD} << EOF
DROP DATABASE IF EXISTS aodh;
CREATE DATABASE aodh;
GRANT ALL PRIVILEGES ON aodh.* TO 'aodh'@'localhost' IDENTIFIED BY '${AODH_PASSWD}';
GRANT ALL PRIVILEGES ON aodh.* TO 'aodh'@'%' IDENTIFIED BY '${AODH_PASSWD}';
EOF
source ~/admin-openrc
openstack user create --domain default --password ${AODH_PASSWD} aodh
openstack role add --project service --user aodh admin
openstack service create --name aodh --description "Telemetry" alarming
openstack endpoint create --region RegionOne alarming public http://${controllerHost}:8042
openstack endpoint create --region RegionOne alarming internal http://${controllerHost}:8042
openstack endpoint create --region RegionOne alarming admin http://${controllerHost}:8042
yum -y install openstack-aodh-api openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener openstack-aodh-expirer python-aodhclient
cp /etc/aodh/aodh.conf /etc/aodh/aodh.conf_bak
openstack-config --set /etc/aodh/aodh.conf DEFAULT log_file /var/log/aodh/api.log
openstack-config --set /etc/aodh/aodh.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/aodh/aodh.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/aodh/aodh.conf database connection mysql+pymysql://aodh:${AODH_PASSWD}@${controllerHost}/aodh
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken auth_uri http://${controllerHost}:5000
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken auth_url http://${controllerHost}:35357
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken memcached_servers ${controllerHost}:11211
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken interface internalURL
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken region_name RegionOne
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken auth_type password
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken project_domain_id default
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken user_domain_id default
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken project_name service
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken username aodh
openstack-config --set /etc/aodh/aodh.conf keystone_authtoken password ${AODH_PASSWD}
openstack-config --set /etc/aodh/aodh.conf service_credentials auth_type password
openstack-config --set /etc/aodh/aodh.conf service_credentials auth_url http://${controllerHost}:5000/v3
openstack-config --set /etc/aodh/aodh.conf service_credentials memcached_servers ${controllerHost}:11211
openstack-config --set /etc/aodh/aodh.conf service_credentials interface internalURL
openstack-config --set /etc/aodh/aodh.conf service_credentials region_name RegionOne
openstack-config --set /etc/aodh/aodh.conf service_credentials project_domain_id default
openstack-config --set /etc/aodh/aodh.conf service_credentials user_domain_id default
openstack-config --set /etc/aodh/aodh.conf service_credentials project_name service
openstack-config --set /etc/aodh/aodh.conf service_credentials username aodh
openstack-config --set /etc/aodh/aodh.conf service_credentials password ${AODH_PASSWD}
openstack-config --set /etc/aodh/aodh.conf service_credentials interface internalURL
openstack-config --set /etc/aodh/aodh.conf service_credentials region_name RegionOne
su -s /bin/sh -c "aodh-dbsync" aodh
sed -i "/ExecStart/c\ExecStart=/usr/bin/aodh-api --port 8042" /usr/lib/systemd/system/openstack-aodh-api.service
systemctl daemon-reload
systemctl enable openstack-aodh-api.service openstack-aodh-evaluator.service openstack-aodh-notifier.service openstack-aodh-listener.service
systemctl start openstack-aodh-api.service openstack-aodh-evaluator.service openstack-aodh-notifier.service openstack-aodh-listener.service
systemctl status openstack-aodh-api.service openstack-aodh-evaluator.service openstack-aodh-notifier.service openstack-aodh-listener.service
aodh capabilities list
}