OpenStack Xena : Configure Gnocchi2021/11/25 |
Install TDBaaS (Time Series Database as a Service), Gnocchi.
This example is based on the environment like follows.
------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached httpd | | Neutron Server | | Nova Compute | | Keystone Glance | | OVN-Northd | | Open vSwitch | | Nova API | | Cinder Volume | | OVN Metadata Agent | | Cinder API | | iSCSI Target | | OVN-Controller | | | | Heat API/Engine | | | | | | Gnocchi httpd | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | Add users and others for Gnocchi in Keystone. |
# create [gnocchi] user in [service] project [root@dlp ~(keystone)]# openstack user create --domain default --project service --password servicepassword gnocchi +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | default_project_id | 7e53ef14eb894f379ea1929f5defc949 | | domain_id | default | | enabled | True | | id | 47b085b1a80646ba9a77f639d395700b | | name | gnocchi | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+ # add [gnocchi] user in [admin] role [root@dlp ~(keystone)]# openstack role add --project service --user gnocchi admin
# create service entry for [gnocchi] [root@dlp ~(keystone)]# openstack service create --name gnocchi --description "Metric Service" metric +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Metric Service | | enabled | True | | id | 332a9e0b97d64e4d815c8dfd804c3528 | | name | gnocchi | | type | metric | +-------------+----------------------------------+ # define Gnocchi API Host [root@dlp ~(keystone)]# export controller=10.0.0.50
# create endpoint for [gnocchi] (public) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne metric public http://$controller:8041 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 0e460ab969444d9fb154e1c564c38e26 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 332a9e0b97d64e4d815c8dfd804c3528 | | service_name | gnocchi | | service_type | metric | | url | http://10.0.0.50:8041 | +--------------+----------------------------------+ # create endpoint for [gnocchi] (internal) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne metric internal http://$controller:8041 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 4bd780be2b5943968e269463f78be59f | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 332a9e0b97d64e4d815c8dfd804c3528 | | service_name | gnocchi | | service_type | metric | | url | http://10.0.0.50:8041 | +--------------+----------------------------------+ # create endpoint for [gnocchi] (admin) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne metric admin http://$controller:8041 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 6b22c86aff8a4161973f47204c9825a2 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 332a9e0b97d64e4d815c8dfd804c3528 | | service_name | gnocchi | | service_type | metric | | url | http://10.0.0.50:8041 | +--------------+----------------------------------+ |
[2] | Add a User and Database on MariaDB for Gnocchi. |
[root@dlp ~(keystone)]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 139 Server version: 10.5.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database gnocchi; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on gnocchi.* to gnocchi@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on gnocchi.* to gnocchi@'%' identified by 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye |
[3] | Install Gnocchi services on Network Node. |
[root@network ~]# dnf --enablerepo=centos-openstack-xena,powertools,epel -y install openstack-gnocchi-api openstack-gnocchi-metricd python3-gnocchiclient httpd python3-mod_wsgi
|
[4] | Configure Gnocchi. |
[root@network ~]# mv /etc/gnocchi/gnocchi.conf /etc/gnocchi/gnocchi.conf.org
[root@network ~]#
vi /etc/gnocchi/gnocchi.conf # create new [DEFAULT] log_dir = /var/log/gnocchi [api] auth_mode = keystone [database] backend = sqlalchemy # MariaDB connection info [indexer] url = mysql+pymysql://gnocchi:password@10.0.0.30/gnocchi [storage] driver = file file_basepath = /var/lib/gnocchi # Keystone auth info [keystone_authtoken] www_authenticate_uri = http://10.0.0.30:5000 auth_url = http://10.0.0.30:5000 memcached_servers = 10.0.0.30:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = gnocchi password = servicepassword service_token_roles_required = true
[root@network ~]#
vi /etc/httpd/conf.d/10-gnocchi_wsgi.conf # create new Listen 8041 <VirtualHost *:8041> <Directory /usr/bin> 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 / /usr/bin/gnocchi-api </VirtualHost> chmod 640 /etc/gnocchi/gnocchi.conf [root@network ~]# chgrp gnocchi /etc/gnocchi/gnocchi.conf [root@network ~]# su -s /bin/bash gnocchi -c "gnocchi-upgrade" [root@network ~]# systemctl enable --now openstack-gnocchi-metricd httpd |
[5] | If SELinux is enabled, change policy. |
[root@network ~]# semanage port -a -t http_port_t -p tcp 8041 |
[6] | If Firewalld is running, allow service ports. |
[root@network ~]# firewall-cmd --add-port=8041/tcp success [root@network ~]# firewall-cmd --runtime-to-permanent success |
[6] | Verify state on Control Node. |
[root@dlp ~(keystone)]#
dnf --enablerepo=centos-openstack-xena,powertools,epel -y install python3-gnocchiclient
[root@dlp ~(keystone)]#
export OS_AUTH_TYPE=password [root@dlp ~(keystone)]# gnocchi resource list
# OK if no error is shown |
Sponsored Link |