3.09 Installing Graphite - MartinWong06/grafana GitHub Wiki

Step 1: Install graphite-web and graphite-carbon

sudo apt-get update
sudo apt-cache madison graphite-web graphite-carbon
sudo apt-get install graphite-carbon graphite-web

Step 2: Location of Configuration Files

cat /etc/carbon/carbon.conf | egrep -v '#' | sed '/^$/d'

Step 3: Configuring Graphite Carbon

sudo vim /etc/default/graphite-carbon

Set the following variable to true

CARBON_CACHE_ENABLED=true
sudo systemctl start carbon-cache

Step 4: Configuring Graphite Web

sudo vim /etc/graphite/local_settings.py
...
SECRET_KEY = 'MY_SECRET' # enter your own secret key

Step 5: Creating the Database for Graphite Web

This step will hit error

sudo /usr/lib/python3/dist-packages/django/bin/django-admin.py migrate --settings=graphite.settings

Solution

sudo sed -i 's/from cgi import parse_qs/from urllib.parse import parse_qs/' /usr/lib/python3/dist-packages/graphite/render/views.py
find / -name app_settings.py 2>/dev/null /usr/lib/python3/dist-packages/graphite/app_settings.py
sudo sed -i -E "s/('django.contrib.contenttypes')/\1,\n  'django.contrib.messages'/" /usr/lib/python3/dist-packages/graphite/app_settings.py
sudo /usr/lib/python3/dist-packages/django/bin/django-admin.py migrate --settings=graphite.settings
sudo chown _graphite:_graphite /var/lib/graphite/graphite.db

Step 6: Installing a Webserver to Serve Graphite Webapp

sudo apt-get install apache2 libapache2-mod-wsgi-py3
sudo cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available
sudo a2dissite 000-default
sudo a2ensite apache2-graphite
sudo systemctl reload apache2

Step 7: Grant _graphite user Ownership of Log Files

sudo chown _graphite:_graphite /var/log/graphite/info.log
sudo chown _graphite:_graphite /var/log/graphite/exception.log

Step 8: Create super user

sudo /usr/lib/python3/dist-packages/django/bin/django-admin.py createsuperuser --settings=graphite.settings

Step 9: Fix UI issues

sudo ln -s /usr/lib/python3/dist-packages/django/contrib/admin/static/admin/ /usr/share/graphite-web/static/admin

Step 10: Access Graphite UI

http://your IP/admin OR http://your IP:8080

Reference: https://luppeng.wordpress.com/2020/10/28/install-and-setup-graphite-on-ubuntu-server-20-04-via-apt-repository/

⚠️ **GitHub.com Fallback** ⚠️