CentOS 7
Sponsored Link

OpenStack Queens : Configure Gnocchi2018/03/11

 
Install TDBaaS (Time Series Database as a Service), Gnocchi.
This example is based on the emvironment like follows.
     ------------+---------------------------+---------------------------+------------
                 |                           |                           |
             eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
     +-----------+-----------+   +-----------+-----------+   +-----------+-----------+
     |    [ Control Node ]   |   |    [ Storage Node ]   |   |    [ Compute Node ]   |
     |                       |   |                       |   |                       |
     |  MariaDB    RabbitMQ  |   |      Open_vSwitch     |   |        Libvirt        |
     |  Memcached  httpd     |   |        L2_Agent       |   |     Nova_Compute      |
     |  Keystone   Glance    |   |        L3_Agent       |   |      Open_vSwitch     |
     |  Nova_API  Cinder_API |   |     Metadata_Agent    |   |        L2_Agent       |
     |  Neutron_Server       |   |     Cinder_Volume     |   |                       |
     |  Metadata_Agent       |   |        Heat_API       |   |                       |
     |  Gnocchi              |   |      Heat Engine      |   |                       |
     +-----------------------+   +-----------------------+   +-----------------------+

[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  | b1da1070c8af427886d0202f8bbe414f |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | c88a3abbad194ec9a18c101a91a60576 |
| 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          | c1e4e9055d38453490e6b7e283a4c547 |
| name        | gnocchi                          |
| type        | metric                           |
+-------------+----------------------------------+

# define keystone host

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

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 1b3aa18b5d474af7915f366414fe71da |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | c1e4e9055d38453490e6b7e283a4c547 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30:8041            |
+--------------+----------------------------------+

# add endpoint for gnocchi (internal)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 88fcc0e358124e46bc196e9bf2d5d73a |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | c1e4e9055d38453490e6b7e283a4c547 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30:8041            |
+--------------+----------------------------------+

# add endpoint for gnocchi (admin)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f7d7e9d8dd3c464a8a579b7defd2e575 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | c1e4e9055d38453490e6b7e283a4c547 |
| service_name | gnocchi                          |
| service_type | metric                           |
| url          | http://10.0.0.30: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 71
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, 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.
# install from Queens, EPEL

[root@dlp ~(keystone)]#
yum --enablerepo=centos-openstack-queens,epel -y install openstack-gnocchi-api openstack-gnocchi-metricd python2-gnocchiclient
[4] Configure Gnocchi.
[root@dlp ~(keystone)]#
mv /etc/gnocchi/gnocchi.conf /etc/gnocchi/gnocchi.conf.org

[root@dlp ~(keystone)]#
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@dlp ~(keystone)]#
vi /etc/httpd/conf.d/10-gnocchi_wsgi.conf
# create new

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>

[root@dlp ~(keystone)]#
chmod 640 /etc/gnocchi/gnocchi.conf

[root@dlp ~(keystone)]#
chgrp gnocchi /etc/gnocchi/gnocchi.conf

[root@dlp ~(keystone)]#
mkdir /var/www/cgi-bin/gnocchi

[root@dlp ~(keystone)]#
cp /usr/lib/python2.7/site-packages/gnocchi/rest/gnocchi-api /var/www/cgi-bin/gnocchi/app

[root@dlp ~(keystone)]#
chown -R gnocchi. /var/www/cgi-bin/gnocchi

[root@dlp ~(keystone)]#
su -s /bin/bash gnocchi -c "gnocchi-upgrade"

[root@dlp ~(keystone)]#
systemctl start openstack-gnocchi-metricd

[root@dlp ~(keystone)]#
systemctl enable openstack-gnocchi-metricd

[root@dlp ~(keystone)]#
systemctl restart httpd

# show status

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

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

[5] If SELinux is enabled, change policy.
[root@dlp ~(keystone)]#
semanage port -a -t http_port_t -p tcp 8041

[6] If Firewalld is running, allow service port.
[root@dlp ~(keystone)]#
firewall-cmd --add-port=8041/tcp --permanent

success
[root@dlp ~(keystone)]#
firewall-cmd --reload

success
Matched Content