11 安装Ceilometer监控服务

章青青
2023-12-01

11.1通过脚本安装Ceilometer服务

11.2-11.14ceilometer监控服务的操作命令已经编写成shell脚本,通过脚本进行一键安装。如下:

#Controller节点

执行脚本iaas-install-ceilometer-controller.sh进行安装

#Compute节点

执行脚本iaas-install-ceilometer-compute.sh进行安装

11.2 安装Ceilometer监控服务软件包

#Controller节点

# yum install openstack-gnocchi-api openstack-gnocchi-metricd python2-gnocchiclient openstack-ceilometer-notification openstack-ceilometer-central python2-ceilometerclient python-ceilometermiddleware -y

11.3 创建数据库

# mysql -u root -p

mysql> CREATE DATABASE gnocchi;

mysql> GRANT ALL PRIVILEGES ON gnocchi.* TO gnocchi@'localhost' IDENTIFIED BY '$CEILOMETER_DBPASS';

    mysql> GRANT ALL PRIVILEGES ON gnocchi.* TO gnocchi@'%' IDENTIFIED BY  '$CEILOMETER_DBPASS';

11.4 创建用户

# openstack user create --domain $DOMAIN_NAME --password $CEILOMETER_PASS ceilometer

# openstack role add --project service --user ceilometer admin

# openstack user create --domain $DOMAIN_NAME --password $CEILOMETER_PASS gnocchi

# openstack role add --project service --user gnocchi admin

# openstack role create ResellerAdmin

# openstack role add --project service --user ceilometer ResellerAdmin

11.5 创建EndpointAPI端点

# openstack service create --name ceilometer --description "OpenStack Telemetry Service" metering

# openstack service create --name gnocchi --description "Metric Service" metric

# openstack endpoint create --region RegionOne metric public http://$HOST_NAME:8041

# openstack endpoint create --region RegionOne metric internal http://$HOST_NAME:8041

# openstack endpoint create --region RegionOne metric admin http://$HOST_NAME:8041

11.6 配置Ceilometer

# crudini --set /etc/gnocchi/gnocchi.conf DEFAULT log_dir /var/log/gnocchi

# crudini --set /etc/gnocchi/gnocchi.conf api auth_mode keystone

# crudini --set /etc/gnocchi/gnocchi.conf database backend sqlalchemy

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_type password

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken www_authenticate_uri http://$HOST_NAME:5000

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken auth_url http://$HOST_NAME:5000

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken memcached_servers $HOST_NAME:11211

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_domain_name $DOMAIN_NAME

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken user_domain_name $DOMAIN_NAME

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken project_name service

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken username gnocchi

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken password $CEILOMETER_PASS

# crudini --set /etc/gnocchi/gnocchi.conf keystone_authtoken service_token_roles_required true

# crudini --set /etc/gnocchi/gnocchi.conf indexer url mysql+pymysql://gnocchi:$CEILOMETER_DBPASS@$HOST_NAME/gnocchi

# crudini --set /etc/gnocchi/gnocchi.conf storage file_basepath /var/lib/gnocchi

# crudini --set /etc/gnocchi/gnocchi.conf storage driver file

# crudini --set /etc/ceilometer/ceilometer.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/ceilometer/ceilometer.conf api auth_mode keystone

# crudini --set /etc/ceilometer/ceilometer.conf dispatcher_gnocchi filter_service_activity False

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken www_authenticate_uri = http://$HOST_NAME:5000

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_url = http://$HOST_NAME:5000

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken memcached_servers = $HOST_NAME:11211

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_type = password

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken project_domain_name = $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken user_domain_name = $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken project_name = service

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken username = gnocchi

# crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken password = $CEILOMETER_PASS

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials auth_url http://$HOST_NAME:5000

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials memcached_servers $HOST_NAME:11211

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_name $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_name $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials project_name service

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials password $CEILOMETER_PASS

11.7 创建监听端点

创建/etc/httpd/conf.d/10-gnocchi_wsgi.conf文件,添加以下内容:

Listen 8041

<VirtualHost *:8041>

  DocumentRoot /var/www/cgi-bin/gnocchi

  <Directory /var/www/cgi-bin/gnocchi>

    AllowOverride None

    Require all granted

  </Directory>

  CustomLog /var/log/httpd/gnocchi_wsgi_access.log combined

  ErrorLog /var/log/httpd/gnocchi_wsgi_error.log

  SetEnvIf X-Forwarded-Proto https HTTPS=1

  WSGIApplicationGroup %{GLOBAL}

  WSGIDaemonProcess gnocchi display-name=gnocchi_wsgi user=gnocchi group=gnocchi processes=6 threads=6

  WSGIProcessGroup gnocchi

  WSGIScriptAlias / /var/www/cgi-bin/gnocchi/app

</VirtualHost>

11.8 创建数据库

# mkdir /var/www/cgi-bin/gnocchi

# cp /usr/lib/python2.7/site-packages/gnocchi/rest/gnocchi-api /var/www/cgi-bin/gnocchi/app

# chown -R gnocchi. /var/www/cgi-bin/gnocchi

# su -s /bin/bash gnocchi -c "gnocchi-upgrade"

# su -s /bin/bash ceilometer -c "ceilometer-upgrade --skip-metering-database"

11.9 启动服务

# systemctl enable openstack-gnocchi-api.service openstack-gnocchi-metricd.service

# systemctl restart openstack-gnocchi-api.service openstack-gnocchi-metricd.service

#systemctl restart httpd memcached

# systemctl enable openstack-ceilometer-notification.service openstack-ceilometer-central.service

# systemctl restart openstack-ceilometer-notification.service openstack-ceilometer-central.service

11.10 监控组件

# crudini --set /etc/glance/glance-api.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/glance/glance-api.conf oslo_messaging_notifications driver messagingv2

# crudini --set /etc/glance/glance-registry.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/glance/glance-registry.conf oslo_messaging_notifications driver messagingv2

# systemctl restart openstack-glance-api openstack-glance-registry

# crudini --set /etc/cinder/cinder.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/cinder/cinder.conf oslo_messaging_notifications driver messagingv2

# systemctl restart openstack-cinder-api openstack-cinder-scheduler

# crudini --set /etc/heat/heat.conf oslo_messaging_notifications driver messagingv2

# crudini --set /etc/heat/heat.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# systemctl restart openstack-heat-api.service openstack-heat-api-cfn.service openstack-heat-engine.service

# crudini --set /etc/neutron/neutron.conf oslo_messaging_notifications driver messagingv2

# systemctl restart neutron-server.service

# crudini --set /etc/swift/proxy-server.conf  filter:keystoneauth operator_roles "admin, user, ResellerAdmin"

# crudini --set /etc/swift/proxy-server.conf pipeline:main pipeline "catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging ceilometer proxy-server"

# crudini --set /etc/swift/proxy-server.conf filter:ceilometer paste.filter_factory ceilometermiddleware.swift:filter_factory

# crudini --set /etc/swift/proxy-server.conf filter:ceilometer url  rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME:5672/

# crudini --set /etc/swift/proxy-server.conf filter:ceilometer driver  messagingv2

# crudini --set /etc/swift/proxy-server.conf filter:ceilometer topic  notifications

# crudini --set /etc/swift/proxy-server.conf filter:ceilometer log_level  WARN

# systemctl restart openstack-swift-proxy.service

11.11 添加变量参数

# echo "export OS_AUTH_TYPE=password" >> /etc/keystone/admin-openrc.sh

11.12 安装软件包

# compute 节点

# yum install openstack-ceilometer-compute -y

11.13 配置Ceilometer

# crudini --set /etc/ceilometer/ceilometer.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials auth_url http://$HOST_NAME:5000

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials memcached_servers = $HOST_NAME:11211

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials project_domain_name $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials user_domain_name $DOMAIN_NAME

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials project_name service

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials auth_type password

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials username ceilometer

# crudini --set /etc/ceilometer/ceilometer.conf service_credentials password $CEILOMETER_PASS

# crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit True

# crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour

# crudini --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state

# crudini --set /etc/nova/nova.conf oslo_messaging_notifications driver messagingv2

11.14 启动服务

# systemctl enable openstack-ceilometer-compute.service

# systemctl restart openstack-ceilometer-compute.service

# systemctl restart openstack-nova-compute

12 安装Aodh监控服务

12.1通过脚本安装Aodh服务

12.2-12.9 Alarm监控服务的操作命令已经编写成shell脚本,通过脚本进行一键安装。如下:

#Controller节点

执行脚本iaas-install-aodh.sh进行安装

12.2 创建数据库

# mysql -u root -p

mysql> CREATE DATABASE aodh;

mysql> GRANT ALL PRIVILEGES ON aodh.* TO aodh@'localhost' IDENTIFIED BY '$AODH_DBPASS';

mysql> GRANT ALL PRIVILEGES ON aodh.* TO aodh@'%' IDENTIFIED BY  '$AODH_DBPASS';

12.3 创建keystone用户

# openstack user create --domain $DOMAIN_NAME --password $AODH_PASS aodh

# openstack role add --project service --user aodh admin

12.4 创建EndpointAPI

# openstack service create --name aodh --description "Telemetry Alarming" alarming

# openstack endpoint create --region RegionOne alarming public http://$HOST_NAME:8042

# openstack endpoint create --region RegionOne alarming internal http://$HOST_NAME:8042

# openstack endpoint create --region RegionOne alarming admin http://$HOST_NAME:8042

12.5 安装软件包

# yum -y install openstack-aodh-api openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener openstack-aodh-expirer python2-aodhclient

12.6 配置aodh

# crudini --set /etc/aodh/aodh.conf DEFAULT log_dir /var/log/aodh

# crudini --set /etc/aodh/aodh.conf DEFAULT transport_url rabbit://$RABBIT_USER:$RABBIT_PASS@$HOST_NAME

# crudini --set /etc/aodh/aodh.conf api auth_mode keystone

# crudini --set /etc/aodh/aodh.conf api gnocchi_external_project_owner service

# crudini --set /etc/aodh/aodh.conf database connection mysql+pymysql://aodh:$AODH_DBPASS@$HOST_NAME/aodh

# crudini --set /etc/aodh/aodh.conf keystone_authtoken www_authenticate_uri http://$HOST_NAME:5000

# crudini --set /etc/aodh/aodh.conf keystone_authtoken auth_url http://$HOST_NAME:5000

# crudini --set /etc/aodh/aodh.conf keystone_authtoken memcached_servers $HOST_NAME:11211

# crudini --set /etc/aodh/aodh.conf keystone_authtoken auth_type password

# crudini --set /etc/aodh/aodh.conf keystone_authtoken project_domain_name $DOMAIN_NAME

# crudini --set /etc/aodh/aodh.conf keystone_authtoken user_domain_name $DOMAIN_NAME

# crudini --set /etc/aodh/aodh.conf keystone_authtoken project_name service

# crudini --set /etc/aodh/aodh.conf keystone_authtoken username aodh

# crudini --set /etc/aodh/aodh.conf keystone_authtoken password $AODH_PASS

# crudini --set /etc/aodh/aodh.conf service_credentials auth_url http://$HOST_NAME:5000/v3

# crudini --set /etc/aodh/aodh.conf service_credentials auth_type password

# crudini --set /etc/aodh/aodh.conf service_credentials project_domain_name $DOMAIN_NAME

# crudini --set /etc/aodh/aodh.conf service_credentials user_domain_name $DOMAIN_NAME

# crudini --set /etc/aodh/aodh.conf service_credentials project_name service

# crudini --set /etc/aodh/aodh.conf service_credentials username aodh

# crudini --set /etc/aodh/aodh.conf service_credentials password $AODH_PASS

# crudini --set /etc/aodh/aodh.conf service_credentials interface internalURL

12.7 创建监听端点

修改/etc/httpd/conf.d/20-aodh_wsgi.conf文件,添加以下内容:

Listen 8042

<VirtualHost *:8042>

    DocumentRoot "/var/www/cgi-bin/aodh"

    <Directory "/var/www/cgi-bin/aodh">

        AllowOverride None

        Require all granted

    </Directory>

    CustomLog "/var/log/httpd/aodh_wsgi_access.log" combined

    ErrorLog "/var/log/httpd/aodh_wsgi_error.log"

    SetEnvIf X-Forwarded-Proto https HTTPS=1

    WSGIApplicationGroup %{GLOBAL}

    WSGIDaemonProcess aodh display-name=aodh_wsgi user=aodh group=aodh processes=6 threads=3

    WSGIProcessGroup aodh

    WSGIScriptAlias / "/var/www/cgi-bin/aodh/app"

</VirtualHost>

12.8 同步数据库

# mkdir /var/www/cgi-bin/aodh

# cp /usr/lib/python2.7/site-packages/aodh/api/app.wsgi /var/www/cgi-bin/aodh/app

# chown -R aodh. /var/www/cgi-bin/aodh

# su -s /bin/bash aodh -c "aodh-dbsync"

12.9 启动服务

# systemctl restart openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener

#systemctl enable openstack-aodh-evaluator openstack-aodh-notifier openstack-aodh-listener

# systemctl restart httpd memcached

13 添加控制节点资源到云平台

13.1 修改openrc.sh

compute节点的IP和主机名改为controller节点的IP和主机名

13.2 运行iaas-install-nova-compute.sh

在控制节点运行iaas-install-nova-compute.sh

执行过程中需要确认登录controller节点和输入controller节点root用户密码。

 类似资料: