Getting internal error for graphite
Hi,
After installation of graphite getting Internal server error (error code : 500) while hitting from the browser. Could you please check and provide your inputs.
Below log path : /opt/graphite/
file : error.log
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] mod_wsgi (pid=21224): Target WSGI script '/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] mod_wsgi (pid=21224): Exception occurred processing WSGI script '/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] Traceback (most recent call last):
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] File "/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] from graphite.wsgi import application
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] File "/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] from django.
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] ImportError: No module named django.
Thank you in advance.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Graphite Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- rocky
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
What version of Graphite you trying to install? and what's Django version do you have?
Revision history for this message
|
#2 |
PS: For Graphite 1.0.x wsgi can be very simple - https:/
import sys
sys.path.
from graphite.wsgi import application
Revision history for this message
|
#3 |
Hi Denis
Please find the details.
[root@XX ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)
[root@XX ~]#
[root@XX ~]# python -V
Python 2.7.3
[root@XX ~]#
>>> import django
>>> django.VERSION
(1, 9, 9, 'final', 0)
>>>
graphite_web-1.1.0
Revision history for this message
|
#4 |
Hi
please find the more information.
[root@XX conf.d]# cat /opt/graphite/
import sys
sys.path.
from graphite.wsgi import application
[root@XX conf.d]#
[root@XX conf.d]# cat /opt/graphite/
import os
import sys
try:
from importlib import import_module
except ImportError:
from django.
os.environ.
from django.conf import settings
from django.core.wsgi import get_wsgi_
application = get_wsgi_
try:
import whitenoise
except ImportError:
whitenoise = False
else:
# WhiteNoise < 2.0.1 does not support Python 2.6
if sys.version_
if whitenoise_version < (2, 0, 1):
if whitenoise:
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNois
prefix = "/".join(
for directory in settings.
for app_path in settings.
module = import_
directory = os.path.
if os.path.
[root@XX conf.d]#
[root@XX conf.d]# cat /etc/httpd/
# Enable virtualhosts, perhaps by adding this to your server's config somewhere,
# probably the main httpd.conf
# NameVirtualHost *:80
# This line also needs to be in your server's config.
# LoadModule wsgi_module modules/mod_wsgi.so
# You need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# of /opt/graphite/, if you installed graphite somewhere else
# you will need to change all the occurrences of /opt/graphite/
# in this file to your chosen install location.
<IfModule !wsgi_module.c>
LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>
# XXX You need to set this up!
# Read http://
# For example, create a directory /var/run/wsgi and use that.
WSGISocketPrefix run/wsgi
<VirtualHost *:8080>
ServerName XX.XX.XX.XX
ErrorLog /opt/graphite/
CustomLog /opt/graphite/
Header set Access-
# I've found that an equal number of processes & threads tends
# to show the best performance for Graphite (ymmv).
# XXX You will need to create this file! There is a graphite.
# file in this directory that you can safely use, just copy it to graphite.wgsi
# XXX To serve static files, either:
# * Install the whitenoise Python package (pip install whitenoise)
# * Collect static files in a directory by running:
# django-admin.py collectstatic --noinput --settings=
# And set an alias to serve static files with Apache:
Alias /static/ /opt/graphite/
<Directory /opt/graphite/
# URL-prefixed install #
# If using URL_PREFIX in local_settings for URL-prefixed install (that is not located at "/"))
# your WSGIScriptAlias line should look like the following (e.g. URL_PREFX=
# WSGIScriptAlias /graphite /srv/graphite-
# Alias /graphite/static /opt/graphite/
# <Location "/graphite/
# SetHandler None
# </Location>
# XXX In order for the django admin site media to work you
# must change @DJANGO_ROOT@ to be the path to your django
# installation, which is probably something like:
# /usr/lib/
Alias /media/ "@DJANGO_
# The graphite.wsgi file has to be accessible by apache. It won't
# be visible to clients because of the DocumentRoot though.
<Directory /opt/graphite/
</VirtualHost>
[root@XX conf.d]#
Revision history for this message
|
#5 |
Just use simple wsgi file which I posted above.
Revision history for this message
|
#6 |
Thank you for your response.
We are already using same same.
Revision history for this message
|
#7 |
Ah, true.
django.
Revision history for this message
|
#8 |
Thank you for response.
I can see only one Django==1.9.9 in the system.
Could you please help me to find out other version in the system.
Revision history for this message
|
#9 |
Could you please some one help on this.. really appreciated..
Revision history for this message
|
#10 |
Remove old fine (/opt/graphite/
Revision history for this message
|
#12 |
Hi Deniz
After removing the file same repose.
[root@XX webapp]# rm /opt/graphite/
rm: remove regular file `/opt/graphite/
[root@icingamon
[root@XX webapp]# ls -l "/opt/graphite/
ls: cannot access /opt/graphite/
[root@XX webapp]#
Still getting error
:58:55 2017] [error] [client 10.2.201.115] mod_wsgi (pid=11944): Exception occurred processing WSGI script '/opt/graphite/
[Thu Sep 28 02:58:55 2017] [error] [client 10.2.201.115] Traceback (most recent call last):
[Thu Sep 28 02:58:55 2017] [error] [client 10.2.201.115] File "/opt/graphite/
[Thu Sep 28 02:58:55 2017] [error] [client 10.2.201.115] from graphite.wsgi import application
[Thu Sep 28 02:58:55 2017] [error] [client 10.2.201.115] File "/opt/graphite/
[Thu Sep 28 02:58:55 2017] [error] [client 10.2.201.115] ImportError: No module named django.
Revision history for this message
|
#13 |
How you can get error in line 7 of non-existing File "/opt/graphite/
Revision history for this message
|
#14 |
Seems to be something else having the issue.
Revision history for this message
|
#15 |
after rebooting the server.. it is saying site can't be reached.
Revision history for this message
|
#16 |
Hi Denis,
Could you please cross check the file "/etc/httpd/
Revision history for this message
|
#17 |
Looks sane. You need to remove 'Alias /media/ "@DJANGO_
Revision history for this message
|
#18 |
We removed the file and tried..
still getting same issue in the error log
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] File "/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] from graphite.wsgi import application
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] File "/opt/graphite/
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] from django.
[Tue Sep 26 01:28:41 2017] [error] [client 10.2.200.22] ImportError: No module named django.
Revision history for this message
|
#19 |
Sorry, rocky, but this lines are old - from September 26. I'm really doubt that non-existing file can give you this error, especially after server reboot. Please check fresh errors.
Revision history for this message
|
#20 |
ok sure...
Same error.. that is the reason copied for the above line..
Let me share the fresh error log.
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] mod_wsgi (pid=17662): Target WSGI script '/opt/graphite/
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] mod_wsgi (pid=17662): Exception occurred processing WSGI script '/opt/graphite/
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] Traceback (most recent call last):
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] File "/opt/graphite/
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] from graphite.wsgi import application
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] File "/opt/graphite/
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] from django.
[Fri Sep 29 00:11:06 2017] [error] [client 10.2.200.191] ImportError: No module named django.
Revision history for this message
|
#21 |
Sorry, rocky, I ran out of ideas. You should remove file /opt/graphite/
Revision history for this message
|
#22 |
Thank you for response.
Found something .. let me share with you..
[root@XX ~]# ldd /usr/lib64/
libdl.so.2 => /lib64/libdl.so.2 (0x00007febc224
libm.so.6 => /lib64/libm.so.6 (0x00007febc1dc
libc.so.6 => /lib64/libc.so.6 (0x00007febc1a2
[root@XX ~]#
[root@XX ~]# find / -name libpython2.7*
/usr/local/
/usr/local/
/usr/local/
[root@XX ~]#
How to load the module with python version 2.7 ?
Revision history for this message
|
#23 |
You should install proper mod_wsgi module, which build against python 2.7
It depends where do you get python 2.7
If you installed that from 3rd party repo - it's better to pick up mod_wsgi package also there.
if you install python from sources - then you need to build mod_wsgi also from sources, as described for example here - https:/
Revision history for this message
|
#24 |
Thank you for the update..
Issue resolved after updating the module mod_wsgi.so. Please find the reference links and commands
https:/
yum install httpd-devel
/etc/ld.so.conf --> Need to update with location
locate libpython2.7.so.1.0
ldconfig
cd /usr/local/
./configure –-enable-shared CFLAGS=-fPIC
Make
Make install
Cd /root/mod_wsgi-3.4
./configure –-with-
Make
Make install
Service httpd restart
Ldd /usr/lib64/
Netstat –ltnp | grep 80