Forked from bhang/install_graphite_statsd_ubuntu_precise.sh
Last active
December 20, 2015 09:30
-
-
Save mostlygeek/6108373 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update the system | |
sudo apt-get --yes update | |
sudo apt-get --yes upgrade | |
# node.js using PPA (for statsd) | |
sudo apt-get install --yes python-software-properties | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update --yes | |
sudo apt-get install --yes nodejs npm | |
# Install git to get statsd | |
sudo apt-get install --yes git | |
# System level dependencies for Graphite | |
sudo apt-get install --yes 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.10 | |
carbon==0.9.10 | |
graphite-web==0.9.10 | |
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 = ^telemetry.* | |
retentions = 10s:6h,1m:7d,10m:1y | |
EOF | |
sudo cp /tmp/storage-schemas.conf storage-schemas.conf | |
cat > /opt/graphite/conf/storage-aggregation.conf << 'EOF' | |
[aggregate_sparse] | |
pattern = ^telemetry.* | |
xFilesFactor = 0.0 | |
EOF | |
# 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 | |
# | |
# Start it up Ghetto style! | |
# | |
cat > '/etc/rc.local' << EOF | |
#!/bin/sh -e | |
/opt/graphite/bin/carbon-cache.py start | |
exit 0 | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to start node
cd /opt/stastd
node stats.js localConfig.js
start carbon cache
cd /opt/graphite
./bin/carbon-cache.py start
start graphite webapp
cd /opt/graphite/webapp/graphite
python manage.py runserver localhost:8000