Ask Your Question

gnocchi 500 internal server error

asked 2018-11-12 01:06:54 -0500

hamed gravatar image

Hi I install openstack queens and install gnocchi.
when input gnocchi-status command (or other gnocchi commands) get blow erorr :

 root@Controller:~# gnocchi status
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at 
 [no address given] to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<address>Apache/2.4.18 (Ubuntu) Server at localhost Port 8041</address>
 (HTTP 500)

vim /etc/gnocchi/gnocchi.conf :

log_dir = /var/log/gnocchi
coordination_url = redis://controller:6379

auth_mode = keystone

backend = sqlalchemy

# MariaDB connection info
url = mysql+pymysql://gnocchi:hamed@controller/gnocchi

driver = file
file_basepath = /var/lib/gnocchi
#coordination_url = redis://controller:6379

# Keystone auth info
service_token_roles_required = true
auth_type = password
auth_url = http://controller:5000/v3
project_domain_name = Default
user_domain_name = Default
project_name = service
username = gnocchi
password = hamed
interface = internalURL
region_name = RegionOne

openstack version: queens
OS: ubuntu16.04

edit retag flag offensive close merge delete


The gnocchi log files should contain details about the error.

Bernd Bausch gravatar imageBernd Bausch ( 2018-11-12 02:58:39 -0500 )edit

could you gather data by gnocchi? aodh alarm list is in insuffient data for me

yasin lachiny gravatar imageyasin lachiny ( 2018-12-20 02:46:20 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2018-11-12 01:23:39 -0500

yasin lachiny gravatar image

Following config for /etc/apache2/sites-available/gnocchi.conf works fine at this moment:

Listen 8041

<virtualhost *:8041=""> WSGIDaemonProcess gnocchi lang='en_US.UTF-8' locale='en_US.UTF-8' user=stack display-name=%{GROUP} processes=2 threads=32 WSGIProcessGroup gnocchi WSGIScriptAlias / /usr/local/bin/gnocchi-api WSGIApplicationGroup %{GLOBAL}

<IfVersion >= 2.4>
    ErrorLogFormat "%{cu}t %M"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    <IfVersion >= 2.4>
        Require all granted
    <IfVersion < 2.4>
        Order allow,deny
        Allow from all

ErrorLog /var/log/apache2/gnocchi.log
CustomLog /var/log/apache2/gnocchi-access.log combined


WSGISocketPrefix /var/run/apache2

After service apache2 restart output for command gnocchi status is following:

$ gnocchi status +-----------------------------------------------------+-------+ | Field | Value | +-----------------------------------------------------+-------+ | storage/number of metric having measures to process | 0 | | storage/total number of measures to process | 0 | +-----------------------------------------------------+-------+

Not like before:

$ gnocchi status <html><head> <title>403 Forbidden</title> </head><body>


You don't have permission to access /v1/status on this server.

Apache/2.4.18 (Ubuntu) Server at Port 8041
</body></html> (HTTP 403)

edit flag offensive delete link more



tank you very mach. after your solution, i run bellow command:

apt install python-gnocchi

and add export bellow lines into admin-openrc file for 401 error unauthenticated :


export OS_AUTH_TYPE=password
hamed gravatar imagehamed ( 2018-11-12 12:49:27 -0500 )edit


yasin lachiny gravatar imageyasin lachiny ( 2018-11-13 01:50:33 -0500 )edit

answered 2018-11-13 06:30:32 -0500

I faced the same 500 Internal Server Error, as posted above, for the same platform :Openstack Queens multi-node setup on Ubuntu 16.04.4 LTS. Gnocchi version: 4.2.4.

The Apache logs for gnocchi-api (/var/log/apache2/gnocchi_error.log) showed a Python import error:

root@OSControllerTest:/home/osctest# tail -f /var/log/apache2/gnocchi_error.log
2018-11-13 11:17:25.590909 Traceback (most recent call last):
2018-11-13 11:17:25.591242   File "/usr/bin/gnocchi-api", line 20, in <module>
2018-11-13 11:17:25.592009     from gnocchi.cli import api
2018-11-13 11:17:25.592167 ImportError: No module named gnocchi.cli
2018-11-13 12:49:21.263089 mod_wsgi (pid=2049): Target WSGI script '/usr/bin/gnocchi-api' cannot be loaded as Python module.
2018-11-13 12:49:21.263512 mod_wsgi (pid=2049): Exception occurred processing WSGI script '/usr/bin/gnocchi-api'.
2018-11-13 12:49:21.263560 Traceback (most recent call last):
2018-11-13 12:49:21.263605   File "/usr/bin/gnocchi-api", line 20, in <module>
2018-11-13 12:49:21.263762     from gnocchi.cli import api
2018-11-13 12:49:21.263823 ImportError: No module named gnocchi.cli

The import issue was resolved by installing the python-gnocchi package, as suggested by the author above:

apt install python-gnocchi

However, there was still an issue related to authentication (HTTP 401):

osctest@OSControllerTest:~$ gnocchi status
The request you have made requires authentication. (HTTP 401)

This was resolved by setting the environment variable OS_AUTH_TYPE=password in the admin-openrc file. The additional GNOCCHI_ENDPOINT variable as suggested by the author was not required, The final admin-openrc file looks like this:

export OS_USERNAME=admin
export OS_PASSWORD=test123
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_AUTH_URL=http://controller:5000/v3
export OS_AUTH_TYPE=password

After sourcing the updated openrc file, the gnocchi API seems to be working correctly:

osctest@OSControllerTest:~$ gnocchi status
| Field                                               | Value |
| storage/number of metric having measures to process | 0     |
| storage/total number of measures to process         | 0     |

osctest@OSControllerTest:~$ gnocchi server version
| Field   | Value |
| version | 4.2.4 |
edit flag offensive delete link more



tanks. i have same problem, and use your answer and before answer to solve that.

hamed gravatar imagehamed ( 2018-11-14 02:47:33 -0500 )edit

It didn't work for me. After doing this fix I started getting 504 Gateway Timeout.

Nehal gravatar imageNehal ( 2019-07-19 01:46:57 -0500 )edit

answered 2019-05-09 04:22:11 -0500

wahab.icp gravatar image

Hello, I would appreciate if I can get your input on that as I am facing the same issue. I was facing the same issue as you and the log files were showing the same error. I followed the steps you suggested but now i am getting a different error. I am using OpenStack (Rocky) with Ubuntu 18.04.

when i type gnocchi status, I get the following error.

<title>504 Gateway Timeout</title>
<h1>Gateway Timeout</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.</p>
<address>Apache/2.4.29 (Ubuntu) Server at controller Port 8041</address>
 (HTTP 504)

Following are the contents of /var/log/apache2/gnocchi_error.log. I don't understand why is gnocchi checking on port 6379. I have tried it by disabling the coordination_url = redis://controller:6379 in /etc/gnocchi/gnocchi.conf but still no luck.

2019-05-09 11:09:39.916529 ToozConnectionError: Error 111 connecting to controller:6379. Connection refused.
2019-05-09 11:09:44.603123 2019-05-09 11:09:44,602 [16557] ERROR    gnocchi.utils: Unable to initialize coordination driver
2019-05-09 11:09:44.603169 Traceback (most recent call last):
2019-05-09 11:09:44.603180   File "/usr/lib/python2.7/dist-packages/tenacity/", line 333, in call
2019-05-09 11:09:44.603189     result = fn(*args, **kwargs)
2019-05-09 11:09:44.603198   File "/usr/lib/python2.7/dist-packages/gnocchi/cli/", line 45, in get_coordinator_and_start
2019-05-09 11:09:44.603206     coord.start(start_heart=True)
2019-05-09 11:09:44.603215   File "/usr/lib/python2.7/dist-packages/tooz/", line 687, in start
2019-05-09 11:09:44.603223     super(CoordinationDriverWithExecutor, self).start(start_heart)
2019-05-09 11:09:44.603232   File "/usr/lib/python2.7/dist-packages/tooz/", line 423, in start
2019-05-09 11:09:44.603260     self._start()
2019-05-09 11:09:44.603267   File "/usr/lib/python2.7/dist-packages/tooz/drivers/", line 449, in _start
2019-05-09 11:09:44.603274     self._server_info =
2019-05-09 11:09:44.603281   File "/usr/lib/python2.7/", line 35, in __exit__
2019-05-09 11:09:44.603288     self.gen.throw(type, value, traceback)
2019-05-09 11:09:44.603295   File "/usr/lib/python2.7/dist-packages/tooz/drivers/", line 51, in _translate_failures
2019-05-09 11:09:44.603303     cause=e)
2019-05-09 11:09:44.603309   File "/usr/lib/python2.7/dist-packages/tooz/", line 225, in raise_with_cause
2019-05-09 11:09:44.603316     excutils.raise_with_cause(exc_cls, message, *args, **kwargs)
2019-05-09 11:09:44.603324   File "/usr/lib/python2.7/dist-packages/oslo_utils/", line 143, in raise_with_cause
2019-05-09 11:09:44.603331     six.raise_from(exc_cls(message, *args, **kwargs), kwargs.get('cause'))
2019-05-09 11:09:44.603338   File "/usr/lib/python2.7/dist-packages/", line 737, in raise_from
2019-05-09 11:09:44.603345     raise value
2019-05-09 11:09:44.603352 ToozConnectionError: Error 111 connecting to controller:6379. Connection refused.

The same error ... (more)

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2018-11-12 01:06:54 -0500

Seen: 1,827 times

Last updated: Nov 12 '18