美文网首页openstackOpenStack云计算
OpenStack安装Ceilometer+Gnocchi(Pi

OpenStack安装Ceilometer+Gnocchi(Pi

作者: Murray66 | 来源:发表于2018-12-04 15:56 被阅读0次

    Centos7 下安装Ceilometer和Gnocchi,之前按照官网文档装,出现了一些坑,在网上搜了各种资料,最后成功安装,在此记录步骤。之后学习过程中可能会回来完善此文档。

    参考:

    https://bugzilla.redhat.com/show_bug.cgi?id=1425801
    https://review.openstack.org/#/c/437845/4/tripleo_common/tests/utils/test_overcloudrc.py
    https://blog.csdn.net/energysober/article/details/80455775
    https://docs.openstack.org/ceilometer/pike/install/install-base-rdo.html
    https://bugs.launchpad.net/gnocchi/+bug/1672446
    https://gist.github.com/vanduc95/9b2ddff70c1e2a15db0d1e47b1fce1c1

    Step1 准备

    1.导入环境变量

    . admin-openrc
    

    2.创建ceilometer服务

    • 创建ceilometer用户
    openstack user create --domain default --password-prompt ceilometer
    
    • 授予ceilometer用户管理员角色
    openstack role add --project service --user ceilometer admin
    
    • 创建ceilometer服务
    openstack service create --name ceilometer \
      --description "Telemetry" metering
    

    3.创建Gnocchi服务

    • 创建gnocchi用户
    openstack user create --domain default --password-prompt gnocchi
    
    • 授予gnocchi用户管理员角色
    openstack role add --project service --user gnocchi admin
    
    • 创建gnocchi服务
    openstack service create --name gnocchi \
      --description "Metric Service" metric
    
    • 创建服务端点
    openstack endpoint create --region RegionOne \
      metric public http://controller:8041
    openstack endpoint create --region RegionOne \
      metric internal http://controller:8041
    openstack endpoint create --region RegionOne \
      metric admin http://controller:8041
    

    Step2 安装Gnocchi

    1.安装软件包

    yum install openstack-gnocchi-api openstack-gnocchi-metricd python-gnocchiclient -y 
    

    2.创建数据库

    替换 GNOCCHI_DBPASS 为合适的密码

    mysql -u root -p
    
    CREATE DATABASE gnocchi;
    
    GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'localhost' IDENTIFIED BY 'GNOCCHI_DBPASS';
    GRANT ALL PRIVILEGES ON gnocchi.* TO 'gnocchi'@'%' IDENTIFIED BY 'GNOCCHI_DBPASS';
    
    exit;
    

    3.修改配置文件

    重点来了

    尝试过官网的配置,也尝试过网上各种各样的配置,在这个配置下,我成功了

    vim /etc/gnocchi/gnocchi.conf
    
    [keystone_authtoken]
    auth_uri = http://controller:5000/v3
    auth_url = http://controller:35357/v3
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = gnocchi
    password = GNOCCHI_PASS
    interface = internalURL
    region_name = RegionOne
    auth_version = 3
    auth_port = 35357
    
    [api]
    auth_mode = keystone
    
    [database]
    backend = sqlalchemy
    
    [indexer]
    url = mysql+pymysql://gnocchi:GNOCCHI_PASS@controllerv/gnocchi
    
    [storage]
    file_basepath = /var/lib/gnocchi
    driver = file
    

    4.初始化Gnocchi

    gnocchi-upgrade
    

    5.启动服务

    vim /usr/bin/gnocchi-api
    

    找到如下这行

    parser.add_argument('--port', '-p', type=int, default=8000,
                            help='TCP port to listen on')
    

    8000改为8041

    启动服务

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

    Step3 安装Ceilometer

    1.安装软件包

    yum install openstack-ceilometer-notification \
      openstack-ceilometer-central -y
    

    2.修改配置文件

    vim /etc/ceilometer/ceilometer.conf
    
    [dispatcher_gnocchi]
    filter_service_activity = False
    archive_policy = low
    
    [DEFAULT]
    meter_dispatchers = gnocchi
    event_dispatchers = gnocchi
    transport_url = rabbit://openstack:RABBIT_PASS@controller
    
    [keystone_authtoken]
    auth_uri = http://controller:5000/v3
    auth_url = http://controller:35357/v3
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = gnocchi
    password = CEILOMETER_PASS
    interface = internalURL
    region_name = RegionOne
    
    [service_credentials]
    auth_uri = http://controller:5000/v3
    auth_url = http://controller:35357/v3
    memcached_servers = controller:11211
    auth_type = password
    project_domain_name = default
    user_domain_name = default
    project_name = service
    username = ceilometer
    password = CEILOMETER_PASS
    interface = internalURL
    region_name = RegionOne
    

    3.更新数据库

    ceilometer-upgrade --skip-metering-database
    

    4.启动服务

    systemctl enable openstack-ceilometer-notification.service \
      openstack-ceilometer-central.service
      
    systemctl start openstack-ceilometer-notification.service \
      openstack-ceilometer-central.service
    

    Step4 验证

    运行:

    . admin-openrc
    gnocchi status
    
    Unable to establish connection to http://localhost:8041/v1/status?details=False: HTTPConnectionPool(host='localhost', port=8041): Max retries exceeded with url: /v1/status?details=False (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f895ad06e50>: Failed to establish a new connection: [Errno 111] \xe6\x8b\x92\xe7\xbb\x9d\xe8\xbf\x9e\xe6\x8e\xa5',))
    
    

    为什么会这样?因为之前的环境变量里少了一个 export OS_AUTH_TYPE=password

    . admin-openrc里加入此环境变量如下:

    export OS_PROJECT_DOMAIN_NAME=Default
    export OS_USER_DOMAIN_NAME=Default
    export OS_PROJECT_NAME=admin
    export OS_USERNAME=admin
    export OS_PASSWORD=PASSWORD
    export OS_AUTH_URL=http://controller:35357/v3
    export OS_IDENTITY_API_VERSION=3
    export OS_IMAGE_API_VERSION=2
    export OS_AUTH_TYPE=password
    

    再次运行:

    gnocchi status
    +-----------------------------------------------------+-------+
    | Field                                               | Value |
    +-----------------------------------------------------+-------+
    | storage/number of metric having measures to process | 39    |
    | storage/total number of measures to process         | 39    |
    +-----------------------------------------------------+-------+
    
    gnocchi metric list | grep cpu
    | 0d5f6722-315e-4ac9-9c4f-1c1d827cb0bc | low                 | cpu.delta                     | None    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | 188996eb-99aa-446d-b34c-ad0f31a3f0a3 | low                 | cpu_util                      | None    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | 1c959473-6f2b-4208-8d6a-b8590b4ea9d1 | low                 | cpu                           | None    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | 2ffbc347-90da-4309-9d0c-81202b90c3a3 | low                 | cpu.delta                     | None    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | 3285ce3a-1e63-486e-8862-7305cfa9012f | low                 | perf.cpu.cycles               | None    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | 37417b10-91db-46e6-9dee-227e69f5f46a | low                 | cpu_l3_cache                  | None    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | 3d20f6e6-a417-463e-9a1a-79fb702e5236 | low                 | perf.cpu.cycles               | None    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | 3e5940fc-7641-46e0-ae23-5aa61b60e6fe | low                 | vcpus                         | vcpu    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | 4361d02b-2d6c-4e9e-9581-6ab98f57fb16 | low                 | cpu_l3_cache                  | None    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    | 453f5769-41c9-4ff3-af2e-e2ae6ab5162a | low                 | cpu                           | None    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | 4783310b-145e-4d87-92f7-6470766fa82b | low                 | vcpus                         | vcpu    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | 4acb77ec-fc08-42ea-b439-9509834ee1fb | low                 | cpu.delta                     | None    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | 507ceb5f-81e8-47ee-93b9-ecb42c5c0a97 | low                 | cpu_util                      | None    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    | 53d8f6ad-2b1c-43e2-8924-dd243a350b1a | low                 | cpu_l3_cache                  | None    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | 5bc26a07-124e-4ef8-a271-8d78fcdfb02d | low                 | cpu                           | None    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    | 6b20df89-5526-4ca9-8ed4-a0f4d048cc82 | low                 | perf.cpu.cycles               | None    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | 7704ee46-19d2-4190-94ca-21e309e146ce | low                 | perf.cpu.cycles               | None    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | 8200ff2c-d98b-4747-96e6-a42f92e92511 | low                 | vcpus                         | vcpu    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    | 95364ced-43fe-406d-85ae-b54c19172f08 | low                 | cpu_util                      | None    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | 970adbd9-8d07-43eb-bf6e-c331098bcba0 | low                 | cpu_l3_cache                  | None    | 15372401-e970-4594-bc19-e65bac9613b8 |
    | a6c9eb56-d03b-494a-9f4a-2e4d28aa83fb | low                 | cpu_util                      | None    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | b029d185-1bae-49e2-a30e-9163d587298e | low                 | vcpus                         | vcpu    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | bba7d20b-136b-4a97-b32a-d46d0c4da0ba | low                 | vcpus                         | vcpu    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | c37fd266-388d-41a5-9e43-8681aae7c32e | low                 | cpu_util                      | None    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | c920747e-6c5c-486d-b48d-ae82d8555ce3 | low                 | cpu.delta                     | None    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    | d8cd33d7-f116-4e2d-9dff-0874de07cde1 | low                 | cpu                           | None    | af17fb57-b153-4629-851e-f818110f0cb4 |
    | e7911ffb-b0f0-4ab3-8d36-89e77607ef37 | low                 | cpu                           | None    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | e8480439-1ae0-465e-98a3-7fd5510816a1 | low                 | cpu.delta                     | None    | 3c5a3159-6b1c-4dd0-858c-80144d0ab89b |
    | ebff6fa5-509e-47ba-8eb1-e386e188b23e | low                 | cpu_l3_cache                  | None    | 6585b577-e3a3-471f-8b68-be9f72eed077 |
    | fb00ca51-6672-49b7-b5b6-f9d17d28f3a6 | low                 | perf.cpu.cycles               | None    | 3f64ed87-dc00-4767-b941-1f7973683adc |
    
    

    证明安装成功

    相关文章

      网友评论

        本文标题:OpenStack安装Ceilometer+Gnocchi(Pi

        本文链接:https://www.haomeiwen.com/subject/ghxvcqtx.html