码迷,mamicode.com
首页 > 其他好文 > 详细

OPENSTACK安装监控报警组件

时间:2019-07-18 13:45:01      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:app   www   erro   ecs   stat   period   awk   memcach   sign   

控制节点执行如下的脚本:

#!/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-gnocchi(){
mysql -uroot -p${MYSQL_ROOT_PASSWD} << EOF
     DROP DATABASE IF EXISTS gnocchi;
     CREATE DATABASE gnocchi;
     GRANT ALL PRIVILEGES ON gnocchi.* TO ‘gnocchi‘@‘localhost‘ IDENTIFIED BY ‘${GNOCCHI_PASSWD}‘;
     GRANT ALL PRIVILEGES ON gnocchi.* TO ‘gnocchi‘@‘%‘ IDENTIFIED BY ‘${GNOCCHI_PASSWD}‘;
EOF
source ~/admin-openrc
openstack user create --domain default --password ${GNOCCHI_PASSWD} gnocchi
openstack role add --project service --user gnocchi admin
openstack service create --name gnocchi --description "Metric Service" metric
openstack endpoint create --region RegionOne metric public http://${controllerHost}:8041
openstack endpoint create --region RegionOne metric internal http://${controllerHost}:8041
openstack endpoint create --region RegionOne metric admin http://${controllerHost}:8041
yum -y install openstack-gnocchi-api openstack-gnocchi-metricd python2-gnocchiclient
cp /etc/gnocchi/gnocchi.conf /etc/gnocchi/gnocchi.conf_bak
openstack-config --set /etc/gnocchi/gnocchi.conf DEFAULT log_dir /var/log/gnocchi
openstack-config --set /etc/gnocchi/gnocchi.conf api auth_mode keystone
openstack-config --set /etc/gnocchi/gnocchi.conf database backend sqlalchemy
openstack-config --set /etc/gnocchi/gnocchi.conf indexer url mysql+pymysql://gnocchi:${GNOCCHI_PASSWD}@${controllerHost}/gnocchi
openstack-config --set /etc/gnocchi/gnocchi.conf storage driver file
openstack-config --set /etc/gnocchi/gnocchi.conf storage file_basepath /var/lib/gnocchi
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_uri http://${controllerHost}:5000
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_url http://${controllerHost}:35357
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken memcached_servers ${controllerHost}:11211
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_version 3
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken interface internalURL
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken region_name RegionOne
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_name service
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_type password
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken username gnocchi
openstack-config --set /etc/gnocchi/gnocchi.conf keystone_authtoken password ${GNOCCHI_PASSWD}
gnocchi-upgrade
cat <<EOF> /etc/httpd/conf.d/10-gnocchi_wsgi.conf
Listen 8041
<VirtualHost *:8041>
   ServerName controller
   DocumentRoot "/var/www/cgi-bin/gnocchi"
   <Directory "/var/www/cgi-bin/gnocchi">
     Options Indexes FollowSymLinks MultiViews
     AllowOverride None
     Require all granted
   </Directory>
   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"
</VirtualHost>
EOF
mkdir /var/www/cgi-bin/gnocchi/
separateversion=‘queens‘
echo $OPENSTACK_RELEASE $separateversion | awk ‘$OPENSTACK_RELEASE >= $separateversion {/usr/bin/cp -a /usr/lib/python2.7/site-packages/gnocchi/rest/wsgi.py /var/www/cgi-bin/gnocchi/app}‘
echo $OPENSTACK_RELEASE $separateversion | awk ‘$OPENSTACK_RELEASE <  $separateversion {/usr/bin/cp -a /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
systemctl restart httpd
systemctl enable openstack-gnocchi-metricd
systemctl restart openstack-gnocchi-metricd && systemctl status openstack-gnocchi-metricd
}
controller-ceilometer(){
source ~/admin-openrc
openstack user create --domain default --password ${CEILOMETER_PASSWD} ceilometer
openstack role add --project service --user ceilometer admin
openstack service create --name ceilometer --description "Telemetry" metering
yum -y install  openstack-ceilometer-collector openstack-ceilometer-notification openstack-ceilometer-central python-ceilometerclient
cp /etc/ceilometer/ceilometer.conf /etc/ceilometer/ceilometer.conf_bak
openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT meter_dispatchers gnocchi
openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT event_dispatchers gnocchi
openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi filter_service_activity False
openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi archive_policy low
openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_uri http://${controllerHost}:5000/v3
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_url http://${controllerHost}:35357/v3
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials memcached_servers ${controllerHost}:11211
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_name default
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_name default
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_name service
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials interface internalURL
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials region_name RegionOne
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials password ${CEILOMETER_PASSWD}
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_uri http://${controllerHost}:5000/v3
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_url http://${controllerHost}:35357/v3
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken memcached_servers ${controllerHost}:11211
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken project_name service
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken interface internalURL
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken region_name RegionOne
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_type password
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken username gnocchi
openstack-config --set /etc/ceilometer/ceilometer.conf keystone_authtoken password ${GNOCCHI_PASSWD}
ceilometer-upgrade --skip-metering-database
systemctl enable openstack-ceilometer-notification.service openstack-ceilometer-central.service
systemctl restart openstack-ceilometer-notification.service openstack-ceilometer-central.service
systemctl status openstack-ceilometer-notification.service openstack-ceilometer-central.service
echo ‘export OS_AUTH_TYPE=password‘ >> ~/admin-openrc
source ~/admin-openrc
gnocchi status
gnocchi metric list | grep cpu
}
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
}
controller-ceilometer-interval(){
sed -i "/interval/c\      interval: 60" /etc/ceilometer/polling.yaml
systemctl restart openstack-ceilometer*
systemctl status openstack-ceilometer*
}
RUN_CONTROLLER(){
controller_gnocchi
controller-ceilometer
controller-aodh
#controller-ceilometer-interval
}
RUN_CONTROLLER

计算节点执行下面的脚本:

#!/bin/bash
CEILOMETER_PASSWD=‘ceilometer1234!‘
RABBIT_PASSWD=‘0penstackRMQ‘
controllerHost=‘controller‘
OPENSTACK_RELEASE=‘queens‘
compute-ceilometer(){
yum -y install openstack-ceilometer-compute
cp /etc/ceilometer/ceilometer.conf /etc/ceilometer/ceilometer.conf_bak
openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT transport_url rabbit://openstack:${RABBIT_PASSWD}@${controllerHost}:5672
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_url  http://${controllerHost}:5000/v3
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials memcached_servers ${controllerHost}:11211
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_id  default
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_id default
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials project_name service
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials password ${CEILOMETER_PASSWD}
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials interface internalURL
openstack-config --set /etc/ceilometer/ceilometer.conf service_credentials region_name RegionOne
systemctl enable openstack-ceilometer-compute.service
systemctl restart openstack-ceilometer-compute.service
systemctl status openstack-ceilometer-compute.service
}
compute-nova-useceilometer(){
openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit True
openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour
openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state
openstack-config --set /etc/nova/nova.conf oslo_messaging_notifications driver messagingv2
systemctl restart openstack-nova-compute.service
systemctl status openstack-nova-compute.service
}
compute-ceilometer-interval(){
sed -i "/interval/c\      interval: 60" /etc/ceilometer/polling.yaml
systemctl restart openstack-ceilometer*
systemctl status openstack-ceilometer*
}
RUN-COMPUTE(){
compute-ceilometer
compute-nova-useceilometer
#compute-ceilometer-interval
}
RUN-COMPUTE

OPENSTACK安装监控报警组件

标签:app   www   erro   ecs   stat   period   awk   memcach   sign   

原文地址:https://www.cnblogs.com/jipinglong/p/11206585.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!