Install Graphite and Nginx on Ubuntu 14.04

Source: Internet
Author: User

Install Graphite and Nginx on Ubuntu 14.04

Graphite is a real-time monitoring software. It consists of three parts: wishper for data storage, carbon for data reception, and Graphite-web for visual display, the three are good-performing enterprise-level open-source monitoring software. Currently, Douban and waste are in use in China ~ The following installation assumes that your system is just installed with Ubuntu 14.04.

1. Update the software package index and System
sudo apt-get updatesudo apt-get upgrade
2. Install and update graphite Dependencies

sudo apt-get install python-django python-cairo python-pip python-django-tagging

3. Install twisted

Because carbon is dependent on a specific version of twisted, you cannot install the latest version of twisted simply by using pip.

To make twisted compilation and installation smooth,sudo apt-get install python-dev

sudo pip install "twisted<12.0"

4. Install nginx and uwsgi and corresponding modules (graphite-web is developed based on django)

sudo apt-get install -y nginx uwsgi-plugin-python uwsgi

5. Install graphite Kit

sudo pip install whisper carbon graphite-web

The above completes the graphite dependency environment and all of its own installations, and then configures graphite, nginx, and uwsgi based on actual needs, which is actually based on nginx to configure the django application, the details are as follows:

6. modify the configuration file (nginx, uwsgi, graphite,) Graphite

/opt/graphite/Is the default installation path of graphite, where/opt/graphite/conf/Graphite configuration file

cp storage-schemas.conf.example storage-schemas.confcp storage-aggregation.conf.example storage-aggregation.confcp carbon.conf.example carbon.confcp graphite.wsgi.example wsgi.pycp /opt/graphite/webapp/graphite/{local_settings.py.example,local_settings.py}

Openlocal_settings.pyModify Time ZoneTIME_ZONE='Asia/Shanghai'

Nginx
#/etc/nginx/sites-available/graphiteserver {   listen 8080;   charset utf-8;   access_log /var/log/nginx/graphite.access.log;   error_log  /var/log/nginx/graphite.error.log;   location /{    include uwsgi_params;    uwsgi_pass 0.0.0.0:8888;}}

Create a soft connection to site-enabled to enable this VirtualHost

ln -s /etc/nginx/sites-available/graphite /etc/nginx/sites-enabled/

UWSGI
#/etc/uwsgi/apps-available/graphite.ini[uwsgi] processes =2socket =0.0.0.0:8888gid = www-datauid = www-datachdir =/opt/graphite/confmodule= wsgi:applicationdpuf

Create a soft connection to/etc/uwsgi/apps-enabled to make the configuration take effectln -s /etc/uwsgi/apps-available/graphite.ini /etc/uwsgi/apps-enabled/

The preceding three configurations are completed, but it is better to manage uwsgi startup through the supervisor process daemon, so that uwsgi plug-ins can be effectively prevented.

Graphite (Dajngo)

After the configuration, you can start graphite, but before that, you need to synchronize the graphite database and modify some file permissions, as shown below:sudo python /opt/graphite/webapp/graphite/manage.py syncdbIt is the same as that in Django, but you must consider the file path permissions. Otherwise, the permission database may not be able to be created successfully.

Modify/opt/graphite/webappAnd/opt/graphite/storageThe File Permission iswww-dataBecause the uwsgi startup user iswww-data

chown -R www-data:www-data /opt/graphite/webapp/ /opt/graphite/storage/

7. Start graphite

So far, everything is done. Open carbon first, then enable uwsgi, and then nginx.

/opt/graphite/bin/carbon-cache.py start/etc/init.d/uwsgi restart/etc/init.d/nginx restart

Open your browser and enterhttp://ip:8080You can see the results. If you cannot correctly plot the data, you need to troubleshoot nginx or uwsgi problems. Generally, most errors occur here.

Troubleshooting you may need these logs

# Nginx log/var/log/nginx/graphite. error. log/var/log/nginx/graphite. access. log # uwsgi log/var/log/uwsgi/app/graphite. log
Note: ImportError: No module named defaults

The last question is caused by the django version.ImportError:Nomodule named defaultsError because this module has been deleted in django1.6, but graphite is still version 1.5. All you need to modify isdjango.conf.urls.defaultsChangefrom django.conf.urls import patterns, url, includeThere are about 10 such files. Another method is to install graphite-web through the source code, because the bug has been fixed in the master branch of graphite, this problem occurs through binary installation. Most of the problems are that the update is not timely to the binary package. This shows the advantages of source code installation ~, Whatever, you can still see the drawing, and then use statsd, collectd and other data collection tools to feed graphite data. In the future, I will write relevant case articles, so stay tuned ~

-End-

Install Graphite in Ubuntu 14.04

Install Graphite in CentOS 5.5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.