zoukankan      html  css  js  c++  java
  • 安装gnocchi

    在控制节点上执行


    #!/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
    }

  • 相关阅读:
    Oracle 安装报错 [INS-06101] IP address of localhost could not be determined 解决方法输入日志标题
    Linux下安装oracle数据库提示DISPLAY not set. Please set the DISPLAY and try again。
    redhat 关机注销命令详解
    VirtualBox的四种网络连接方式
    修改RedHat的系统显示时间
    insufficient memory to configure kdump(没有足够的内存)解决方法(待验证、待解决)
    xen坑随笔 heartbeat dpkg垃圾数据库清除
    tomcat 监控脚本
    负载均衡随笔
    GIT命令介绍
  • 原文地址:https://www.cnblogs.com/jipinglong/p/11223119.html
Copyright © 2011-2022 走看看