Graphs not rendering, image cannot be displayed because it contains errors

Asked by Yue Zhang

I am new to graphite. After setting it up, I ran into the issue that no graphs can be view (or plotted) but everything else seems fine. If I tried to open the graph directly from url: http://127.0.0.1:8080/render/?width=1041&height=568&_salt=1438645747.311&target=system.loadavg_1min. It says "The image http://.... cannot be displayed because it contains errors".

Below is the output in console when I tried clicked on "loadavg_1min" and displayed it:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 86, in run
    self.finish_response()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
    self.write(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 212, in write
    self.send_headers()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
    self.send_preamble()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 197, in send_preamble
    self._write('Server: %s\r\n' % self.server_software)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 324, in write
    self.flush()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 41] Protocol wrong type for socket
[03/Aug/2015 17:07:28]"GET /render/?width=1041&height=568&_salt=1438646839.464&target=system.loadavg_1min HTTP/1.1" 500 59
- Broken pipe from ('127.0.0.1', 51580)

I will provide more details if that's needed, I just wonder what kind of error is this ? Thank you !

Question information

Language:
English Edit question
Status:
Expired
For:
Graphite Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jason Dixon (jason-dixongroup) said :
#1

That's a very unusual error:

error: [Errno 41] Protocol wrong type for socket

It suggests there's something profoundly broken about your setup or the platform you're trying to run it on. Can you give us more details about your setup?

Jason

Revision history for this message
Yue Zhang (deyomizy) said :
#2

Actually I have tried a lot of times but can not regenerate the "Protocol wrong type for socket" but again got this every time:
[03/Aug/2015 21:07:06]"GET /render/?width=1041&height=542&_salt=1438661217.502 HTTP/1.1" 200 4
- Broken pipe from ('127.0.0.1', 52538)

There are nothing special about my setup, I use a Mac 10.10 and totally follow the documentation to follow the initialization, everything is default except the "CARBONLINK_HASHING_KEYFUNC" in local_settings.py, which I set it to "None". And I followed this link to get started: http://graphite.wikidot.com/quickstart-guide.

Below is my whole local_settings.py:

## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well

#####################################
# General Configuration #
#####################################
# Set this to a long, random unique string to use as a secret key for this
# install. This key is used for salting of hashes used in auth tokens,
# CRSF middleware, cookie storage, etc. This should be set identically among
# instances if used behind a load balancer.
SECRET_KEY = 'UNSAFE_DEFAULT'

# In Django 1.5+ set this to the list of hosts your graphite instances is
# accessible as. See:
# https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-ALLOWED_HOSTS
ALLOWED_HOSTS = [ '*' ]

# Set your local timezone (Django's default is America/Chicago)
# If your graphs appear to be offset by a couple hours then this probably
# needs to be explicitly set to your local timezone.
TIME_ZONE = 'America/Los_Angeles'

# Override this to provide documentation specific to your Graphite deployment
DOCUMENTATION_URL = "http://graphite.readthedocs.org/"

# Metric data and graphs are cached for one minute by default
DEFAULT_CACHE_DURATION = 60

# Logging
LOG_RENDERING_PERFORMANCE = True
LOG_CACHE_PERFORMANCE = True
LOG_METRIC_ACCESS = True

# Enable full debug page display on exceptions (Internal Server Error pages)
DEBUG = True

# If using RRD files and rrdcached, set to the address or socket of the daemon
FLUSHRRDCACHED = 'unix:/var/run/rrdcached.sock'

# This lists the memcached servers that will be used by this webapp.
# If you have a cluster of webapps you should ensure all of them
# have the *exact* same value for this setting. That will maximize cache
# efficiency. Setting MEMCACHE_HOSTS to be empty will turn off use of
# memcached entirely.
#
# You should not use the loopback address (127.0.0.1) here if using clustering
# as every webapp in the cluster should use the exact same values to prevent
# unneeded cache misses. Set to [] to disable caching of images and fetched data
MEMCACHE_HOSTS = ['10.10.10.10:11211', '10.10.10.11:11211', '10.10.10.12:11211']
DEFAULT_CACHE_DURATION = 60 # Cache images and data for 1 minute
MEMCACHE_KEY_PREFIX = 'graphite'

# Set URL_PREFIX when deploying graphite-web to a non-root location
URL_PREFIX = '/graphite'

#####################################
# Filesystem Paths #
#####################################
# Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite
# to somewhere else
GRAPHITE_ROOT = '/opt/graphite'

# Most installs done outside of a separate tree such as /opt/graphite will only
# need to change these three settings. Note that the default settings for each
# of these is relative to GRAPHITE_ROOT
CONF_DIR = '/opt/graphite/conf'
STORAGE_DIR = '/opt/graphite/storage'
STATIC_ROOT = '/opt/graphite/static'

# To further or fully customize the paths, modify the following. Note that the
# default settings for each of these are relative to CONF_DIR and STORAGE_DIR
#
## Webapp config files
DASHBOARD_CONF = '/opt/graphite/conf/dashboard.conf'
GRAPHTEMPLATES_CONF = '/opt/graphite/conf/graphTemplates.conf'

## Data directories
# NOTE: If any directory is unreadable in STANDARD_DIRS it will break metric browsing
CERES_DIR = '/opt/graphite/storage/ceres'
WHISPER_DIR = '/opt/graphite/storage/whisper'
RRD_DIR = '/opt/graphite/storage/rrd'
# Data directories using the "Standard" finder (i.e. not Ceres)
STANDARD_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
LOG_DIR = '/opt/graphite/storage/log/webapp'
INDEX_FILE = '/opt/graphite/storage/index' # Search index file

#####################################
# Email Configuration #
#####################################
# This is used for emailing rendered Graphs
# Default backend is SMTP
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
# To drop emails on the floor, enable the Dummy backend:
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'

#####################################
# Authentication Configuration #
#####################################
## LDAP / ActiveDirectory authentication setup
USE_LDAP_AUTH = True
LDAP_SERVER = "ldap.mycompany.com"
LDAP_PORT = 389
LDAP_USE_TLS = False
# OR
LDAP_URI = "ldaps://ldap.mycompany.com:636"
LDAP_SEARCH_BASE = "OU=users,DC=mycompany,DC=com"
LDAP_BASE_USER = "CN=some_readonly_account,DC=mycompany,DC=com"
LDAP_BASE_PASS = "readonly_account_password"
LDAP_USER_QUERY = "(username=%s)" #For Active Directory use "(sAMAccountName=%s)"
#
# If you want to further customize the ldap connection options you should
# directly use ldap.set_option to set the ldap module's global options.
# For example:
#
#import ldap
#ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW) # Use ldap.OPT_X_TLS_DEMAND to force TLS
#ldap.set_option(ldap.OPT_REFERRALS, 0) # Enable for Active Directory
#ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, "/etc/ssl/ca")
#ldap.set_option(ldap.OPT_X_TLS_CERTFILE, "/etc/ssl/mycert.pem")
#ldap.set_option(ldap.OPT_X_TLS_KEYFILE, "/etc/ssl/mykey.pem")
#ldap.set_option(ldap.OPT_DEBUG_LEVEL, 65535) # To enable verbose debugging
# See http://www.python-ldap.org/ for further details on these options.

## REMOTE_USER authentication. See: https://docs.djangoproject.com/en/dev/howto/auth-remote-user/
USE_REMOTE_USER_AUTHENTICATION = True

# Override the URL for the login link (e.g. for django_openid_auth)
LOGIN_URL = '/account/login'

###############################
# Authorization for Dashboard #
###############################
# By default, there is no security on dashboards - any user can add, change or delete them.
# This section provides 3 different authorization models, of varying strictness.

# If set to True, users must be logged in to save or delete dashboards. Defaults to False
DASHBOARD_REQUIRE_AUTHENTICATION = True

# If set to the name of a user group, dashboards can be saved and deleted by any user in this
# group. Groups can be set in the Django Admin app, or in LDAP. Defaults to None.
# NOTE: Ignored if DASHBOARD_REQUIRE_AUTHENTICATION is not set
DASHBOARD_REQUIRE_EDIT_GROUP = 'dashboard-editors-group'

# If set to True, dashboards can be saved or deleted by any user having the appropriate
# (change or delete) permission (as set in the Django Admin app). Defaults to False
# NOTE: Ignored if DASHBOARD_REQUIRE_AUTHENTICATION is not set
DASHBOARD_REQUIRE_PERMISSIONS = True

##########################
# Database Configuration #
##########################
# By default sqlite is used. If you cluster multiple webapps you will need
# to setup an external database (such as MySQL) and configure all of the webapp
# instances to use the same database. Note that this database is only used to store
# Django models such as saved graphs, dashboards, user preferences, etc.
# Metric data is not stored here.
#
# DO NOT FORGET TO RUN 'django-admin.py syncdb' AFTER SETTING UP A NEW DATABASE
#
# The following built-in database engines are available:
# django.db.backends.postgresql_psycopg2
# django.db.backends.mysql
# django.db.backends.sqlite3
# django.db.backends.oracle
#
# The default is 'django.db.backends.sqlite3' with file 'graphite.db'
# located in STORAGE_DIR
#
DATABASES = {
   'default': {
       'NAME': '/opt/graphite/storage/graphite.db',
       'ENGINE': 'django.db.backends.sqlite3',
       'USER': '',
       'PASSWORD': '',
       'HOST': '',
       'PORT': ''
   }
}
#

#########################
# Cluster Configuration #
#########################
# (To avoid excessive DNS lookups you want to stick to using IP addresses only in this entire section)
#
# This should list the IP address (and optionally port) of the webapp on each
# remote server in the cluster. These servers must each have local access to
# metric data. Note that the first server to return a match for a query will be
# used.
CLUSTER_SERVERS = ["10.0.2.2:80", "10.0.2.3:80"]

# These are timeout values (in seconds) for requests to remote webapps
REMOTE_FIND_TIMEOUT = 3.0 # Timeout for metric find requests
REMOTE_FETCH_TIMEOUT = 6.0 # Timeout to fetch series data
REMOTE_RETRY_DELAY = 60.0 # Time before retrying a failed remote webapp
REMOTE_EXCLUDE_LOCAL = False # Try to detect when a cluster server is localhost and don't forward queries
REMOTE_READER_CACHE_SIZE_LIMIT = 1000 # Maximum number of remote URL queries to cache
FIND_CACHE_DURATION = 300 # Time to cache remote metric find results
# If the query doesn't fall entirely within the FIND_TOLERANCE window
# we disregard the window. This prevents unnecessary remote fetches
# caused when carbon's cache skews node.intervals, giving the appearance
# remote systems have data we don't have locally, which we probably do.
FIND_TOLERANCE = 2 * FIND_CACHE_DURATION

## Remote rendering settings
# Set to True to enable rendering of Graphs on a remote webapp
REMOTE_RENDERING = True
# List of IP (and optionally port) of the webapp on each remote server that
# will be used for rendering. Note that each rendering host should have local
# access to metric data or should have CLUSTER_SERVERS configured
RENDERING_HOSTS = []
REMOTE_RENDER_CONNECT_TIMEOUT = 1.0

# If you are running multiple carbon-caches on this machine (typically behind a relay using
# consistent hashing), you'll need to list the ip address, cache query port, and instance name of each carbon-cache
# instance on the local machine (NOT every carbon-cache in the entire cluster). The default cache query port is 7002
# and a common scheme is to use 7102 for instance b, 7202 for instance c, etc.
#
# You *should* use 127.0.0.1 here in most cases
CARBONLINK_HOSTS = ["127.0.0.1:7002:a", "127.0.0.1:7102:b", "127.0.0.1:7202:c"]
CARBONLINK_TIMEOUT = 1.0
CARBONLINK_RETRY_DELAY = 15 # Seconds to blacklist a failed remote server

# A "keyfunc" is a user-defined python function that is given a metric name
# and returns a string that should be used when hashing the metric name.
# This is important when your hashing has to respect certain metric groupings.
# CARBONLINK_HASHING_KEYFUNC = "/opt/graphite/bin/keyfuncs.py:my_keyfunc"
CARBONLINK_HASHING_KEYFUNC = None

# Prefix set in carbon for the carbon specific metrics. Default in carbon is 'carbon'
CARBON_METRIC_PREFIX='carbon'

# The replication factor to use with consistent hashing
# This should usually match the value configured in Carbon
REPLICATION_FACTOR = 1

# How often should render.datalib.fetch() retry to get remote data
MAX_FETCH_RETRIES = 2

#####################################
# Additional Django Settings #
#####################################
# Uncomment the following line for direct access to Django settings such as
# MIDDLEWARE_CLASSES or APPS
#from graphite.app_settings import *

Revision history for this message
Jason Dixon (jason-dixongroup) said :
#3

What happens if you try something simple like:

$ curl -i -s http://127.0.0.1:8080/

Revision history for this message
Yue Zhang (deyomizy) said :
#4

This is what I got, seems nothing unusual here:

HTTP/1.0 200 OK
Date: Tue, 04 Aug 2015 17:22:26 GMT
Server: WSGIServer/0.1 Python/2.7.6
Vary: Cookie, Accept-Encoding
Content-Type: text/html; charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!-- Copyright 2008 Orbitz WorldWide

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. -->

<html>
  <head>
    <title>Graphite Browser</title>
  </head>

<frameset rows="60,*" frameborder="1" border="1">
  <frame src="/browserheader" name="Header" id='header' scrolling="no" noresize="true" />

    <frame src="/composer?" name="content" id="composerFrame"/>

</frameset>
</html>

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.