Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 62 You must be signed in to star a gist
  • Fork 47 You must be signed in to fork a gist
  • Save bhang/2703599 to your computer and use it in GitHub Desktop.
Save bhang/2703599 to your computer and use it in GitHub Desktop.
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
# System level dependencies for Graphite
sudo apt-get install memcached python-dev python-pip sqlite3 libcairo2 \
libcairo2-dev python-cairo pkg-config
# Get latest pip
sudo pip install --upgrade pip
# Install carbon and graphite deps
cat >> /tmp/graphite_reqs.txt << EOF
django==1.3
python-memcached
django-tagging
twisted
whisper==0.9.9
carbon==0.9.9
graphite-web==0.9.9
EOF
sudo pip install -r /tmp/graphite_reqs.txt
#
# Configure carbon
#
cd /opt/graphite/conf/
sudo cp carbon.conf.example carbon.conf
# Create storage schema and copy it over
# Using the sample as provided in the statsd README
# https://github.com/etsy/statsd#graphite-schema
cat >> /tmp/storage-schemas.conf << EOF
# Schema definitions for Whisper files. Entries are scanned in order,
# and first match wins. This file is scanned for changes every 60 seconds.
#
# [name]
# pattern = regex
# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...
[stats]
priority = 110
pattern = ^stats\..*
retentions = 10s:6h,1m:7d,10m:1y
EOF
sudo cp /tmp/storage-schemas.conf storage-schemas.conf
# Make sure log dir exists for webapp
sudo mkdir -p /opt/graphite/storage/log/webapp
# Copy over the local settings file and initialize database
cd /opt/graphite/webapp/graphite/
sudo cp local_settings.py.example local_settings.py
sudo python manage.py syncdb # Follow the prompts, creating a superuser is optional
# statsd
cd /opt && sudo git clone git://github.com/etsy/statsd.git
# StatsD configuration
cat >> /tmp/localConfig.js << EOF
{
graphitePort: 2003
, graphiteHost: "127.0.0.1"
, port: 8125
}
EOF
sudo cp /tmp/localConfig.js /opt/statsd/localConfig.js
@fideloper
Copy link

So far, on Ubuntu 14.04:

  • Installed Django 1.5 (clears cannot import name python_2_unicode_compatible error)
  • sudo vim /opt/graphite/webapp/graphite/settings.py - set the SECRET_KEY to something.

Set a database in local_settings.py.

Error received during sudo python manage.py syncdb:

ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

Anyone know of an example of 14.04? I'm running out of time to track all the various dependencies :D

Edit: This might be the ticket - on 14.04, there appears to be an apt package.

@grekpg
Copy link

grekpg commented May 18, 2015

I try install on this vagrant - https://github.com/irmantas/symfony2-vagrant and have error

vagrant@precise64:/opt/graphite/webapp/graphite$ sudo python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 146, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/opt/graphite/webapp/graphite/events/models.py", line 10, in
from tagging.fields import TagField
File "/usr/local/lib/python2.7/dist-packages/tagging/fields.py", line 9, in
from .models import Tag
File "/usr/local/lib/python2.7/dist-packages/tagging/models.py", line 6, in
from django.utils.encoding import smart_text
ImportError: cannot import name smart_text

@cybercupcake
Copy link

I got the exact same error as the commenter above. Anybody got a solution?

Trying to install on Ubuntu 14.04 X64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment