Before you add Gnocchi as a data source to Grafana, verify that your environment meets the following requirements.
public
endpoints for Gnocchi and for its own
services.public
endpoint must be resolvable from Grafana and your browser.To satisfy the requirements, complete the following prerequisite steps:
Enable CORS for the Gnocchi and Keystone servers:
Open your project Git repository with the Reclass model on the cluster level.
In the openstack/telemetry.yml
file, add the following configuration
for Gnocchi, specifying the vhost FQDN as allowed_origin
:
gnocchi:
server:
cors:
allowed_origin: "http://example.com"
In the openstack/control.yml
file, add the following configuration
for Keystone, specifying the vhost FQDN as allowed_origin
:
keystone:
server:
cors:
allowed_origin: "http://example.com"
Set the endpoints for Keystone and Gnocchi:
In the openstack/init.yml
file, specify the following parameters:
_params:
gnocchi_public_host: example.com
gnocchi_public_port: 80
gnocchi_public_path: '/metric'
keystone_public_path: '/identity'
keystone_public_address: example.com
keystone_public_port: 80
Log in to the Salt Master node.
Apply the following states:
salt 'ctl*' state.sls keystone
salt -C 'I@keystone:client' state.sls keystone.client
salt 'mdb*' state.sls gnocchi
Configure the same HTTP host for Gnocchi and Keystone:
Create a new file /etc/nginx/sites-enabled/nginx_proxy_gnocchi.conf
for the vhost configuration for Gnocchi and specify the following
parameters:
server {
listen 80 default_server;
server_name _;
location ~ ^/metric/?(.*) {
proxy_pass http://172.16.10.250:8041/$1;
proxy_pass_request_body on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~ ^/identity/?(.*) {
proxy_pass http://172.16.10.254:5000/$1;
proxy_pass_request_body on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Verify the new configuration and restart NGINX:
salt -C 'I@nginx:server' cmd.run 'nginx -t && nginx -s reload'
Make the HTTP host resolvable from the browser through an internal DNS or a
static configuration on hosts, for example, /etc/hosts
in Linux.
For a static configuration, run the following command in your console to
add a record in /etc/hosts
, where example.com
is the vhost FQDN:
echo "<grafana_public_ip_address> example.com" >> /etc/hosts
Enable CORS requests in your browser or install a corresponding browser extension. For example, use the Chrome extension or Firefox extension.
Once done, proceed to Add the Gnocchi data source.