Skip to content

Instantly share code, notes, and snippets.

@blackstrip
Forked from rothwerx/lighter-graphite-rpi.sh
Created September 18, 2017 02:38
Show Gist options
  • Save blackstrip/197b601497c035a1840e98ae4743cfbb to your computer and use it in GitHub Desktop.
Save blackstrip/197b601497c035a1840e98ae4743cfbb to your computer and use it in GitHub Desktop.
Bash: Graphite for Raspbian
#!/bin/bash
# A lighter graphite for raspberry pi/raspbian wheezy.
# For when you don't need memcache/rabbitmq/full uWSGI server/etc
# Not fully tested on a clean install. This is just what it *should* take.
# Installing supervisor because upstart conflicts with sysvinit
aptitude update && aptitude install gcc python-dev python-pip python-cairo python-pysqlite2 supervisor
pip install django==1.4.3
pip install django-tagging
pip install twisted
pip install whisper carbon graphite-web
cd /opt/graphite/conf/
for conf in $(ls -1); do
cp $conf ${conf%\.example}
done
cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
cat << 'EOF' >> /opt/graphite/webapp/graphite/local_settings.py
DATABASES = {
'default': {
'NAME': '/opt/graphite/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}
EOF
cd /opt/graphite/webapp/graphite && python manage.py syncdb --no-input
cat << 'EOF' > /etc/supervisor/conf.d/carbon-cache.conf
[program:carbon-cache]
command=/opt/graphite/bin/carbon-cache.py start
autostart=true
EOF
cat << 'EOF' > /etc/supervisor/conf.d/graphite-webapp.conf
[program:graphite-webapp]
command=python /opt/graphite/webapp/graphite/manage.py runserver 0.0.0.0:8000
autostart=true
EOF
supervisorctl reread
supervisorctl add carbon-cache
supervisorctl add graphite-webapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment