Ubuntu 18.04
Sponsored Link

OpenStack Queens : Configure Gnocchi2018/06/20

 
Install TDBaaS (Time Series Database as a Service), Gnocchi.
This example is based on the emvironment like follows.
Gnocchi package of OpenStack Queens on Ubuntu 18.04 uses WSGI with Python3, but other OpenStack Queens components like Keystone or Nova uses WSGI with Python2, so their WSGI package conflicts and cannot install them all on a Node.
 ------------+---------------------------+---------------------------+------------
             |                           |                           |
         eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
 +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
 |    [ Control Node ]   |   |    [ Network Node ]   |   |    [ Compute Node ]   |
 |                       |   |                       |   |                       |
 |  MariaDB    RabbitMQ  |   |      Linux Bridge     |   |        Libvirt        |
 |  Memcached  httpd     |   |        L2_Agent       |   |     Nova_Compute      |
 |  Keystone   Glance    |   |        L3_Agent       |   |      Linux Bridge     |
 |  Nova_API  Cinder_API |   |     Metadata_Agent    |   |        L2_Agent       |
 |  Neutron_Server       |   |     Cinder_Volume     |   |                       |
 |  Metadata_Agent       |   |        Heat_API       |   |                       |
 |                       |   |      Heat Engine      |   |                       |
 |                       |   |    Gnocchi  httpd     |   |                       |
 +-----------------------+   +-----------------------+   +-----------------------+

[1] Add users and others for Gnocchi in Keystone.
# add gnocchi user (set in service project)

root@dlp ~(keystone)#
openstack user create --domain default --project service --password servicepassword gnocchi

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | fa8bf7aca73e44cb9bc2c9f42859857e |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 9eef978756f349698add1c42c0c3cb29 |
| name                | gnocchi                          |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# add gnocchi user in admin role

root@dlp ~(keystone)#
openstack role add --project service --user gnocchi admin
# add service entry for gnocchi

root@dlp ~(keystone)#
openstack service create --name gnocchi --description "Metric Service" metric

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Metric Service                   |
| enabled     | True                             |
| id          | ac87223d7fca4447856416931882a4c9 |
| name        | gnocchi                          |
| type        | metric                           |
+-------------+----------------------------------+

# define gnocchi api host

root@dlp ~(keystone)#
export controller=10.0.0.50
# add endpoint for gnocchi (public)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric public http://$controller:8041

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 91dc89562c1749e798c2928704b2023d |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac87223d7fca4447856416931882a4c9 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.50:8041            |
+--------------+----------------------------------+

# add endpoint for gnocchi (internal)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric internal http://$controller:8041

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 8a8097b76139406db15c9bbef3beeaff |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac87223d7fca4447856416931882a4c9 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.50:8041            |
+--------------+----------------------------------+

# add endpoint for gnocchi (admin)

root@dlp ~(keystone)#
openstack endpoint create --region RegionOne metric admin http://$controller:8041

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 8675bfbcce094475b4f45358ee2556c4 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ac87223d7fca4447856416931882a4c9 |
| 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 -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 86
Server version: 10.1.29-MariaDB-6 Ubuntu 18.04

Copyright (c) 2000, 2017, 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. For selection during installation, it's OK with [No] all.
root@network:~#
apt -y install gnocchi-api gnocchi-metricd python-gnocchiclient
[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:~#
chmod 644 /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 restart gnocchi-metricd apache2

root@network:~#
systemctl enable gnocchi-metricd

# show status on Control Node

root@dlp ~(keystone)#
export OS_AUTH_TYPE=password

root@dlp ~(keystone)#
gnocchi resource list
# no problem if no error is shown

Matched Content