Install Graphite in Ubuntu 14.04

Source: Internet
Author: User

Install Graphite in Ubuntu 14.04
What is Graphite?

First, let's take a look at how Baidu encyclopedia introduces

Graphite is a Python-written web application that uses the django framework. Graphite is used to collect all the server's real-time statuses, user request information, Memcached hit rate, and RabbitMQ Message Server Status, for the Load Status of Unix operating systems, the Graphite server requires about 4800 update operations per minute. Graphite uses simple text protocols and plotting functions for convenient use on any operating system.

What Baidu encyclopedia says is clear,GraphiteIt is used to monitor systems, such as operating systems and cache service systems. But how can we obtain the monitoring data?GraphiteIt is not responsible. It is only responsible for displaying where data comes from, and you only need to give it according to its data format,GraphiteYou can use a pretty page to show it to you, but don't worry,graphiteA series of packages providedAPIYou don't have to worry about how to store the data, just send the data to it. So well, how can I install it?

Don't worry, things are not so perfect,GraphiteW is not supportedindowsThereforeWindowsOfCoderIt is a little lost, but it doesn't matter. I believe there is a solution as a programmer. These are all small things.

EnterGraphiteWorld!

Install

Operating System: Ubuntu 14.04
Python: 2.7.6

Install graphiteEnvironment

GraphiteThe supported environments are as follows:
* A UNIX-like Operating System
* Python 2.6 or greater
* Pycairo
* Django 1.4 or greater
* Django-tagging 0.3.1 or greater
* Twisted 8.0 or greater (10.0 + recommended)
* Zope-interface (often included in Twisted package dependency)
* Pytz
* Fontconfig and at least one font package (a system package usually)
* A wsgi server and web server. Popular choices are:
* Apache with mod_wsgi
* Gunicorn with nginx
* UWSGI with nginx

UbuntuAlready installedpythonSo you do not need to install it again. You only need to ensure that the version is later than or equal to 2.6. Here we select the serverApacheIf you have already installed it, you do not need to install it. You only need to install the WSGI module.libapache2-mod-wsgi.
The following are the commands for installing all the supported environments. We recommend that you install them one by one to check whether each installation is successful.

$sudo apt-get update$ sudo apt-get install apache2 libapache2-mod-wsgi python-django python-twisted python-cairo python-pip python-django-tagging
Install GraphiteThree major components
  • Whisper (database)
  • Carbon (monitoring data, default port 2003, external program StatsD transmits sample data to Graphite through this port)
  • Graphite-web (web UI)

UsepipCommand to quickly install

$sudo pip install whisper$sudo pip install carbon$sudo pip install graphite-web

After the installation is complete, the/opt/graphite directory is used by default.

Then usePipInstallpytzFor conversionTIME_ZONE, Which will be introduced later

$ sudo pip install pytz
Configuration graphite

Go to the/opt/graphite/conf directory and useExample Configuration

$ sudo cp carbon.conf.example carbon.conf $ sudo cp storage-schemas.conf.example storage-schemas.conf $ sudo cp graphite.wsgi.example graphite.wsgi  
Is apacheAdd GraphiteVirtual Host

InstallgraphiteWill generate/opt/graphite/exampleFolder, which contains a configured VM file to copy itApachePlace the configuration file of the VM. The default value is the/etc/apache2/sites-available folder.

$sudo cp /opt/graphite/example/example-graphite-vhost.conf    /etc/apache2/sites-available/graphite-vhost.conf

Then, edit the default directory of listening port 8008 and WSGISocketPrefix as follows:

Create a soft link for this configuration file under/etc/apache2/sites-enable

$cd /etc/apache2/sites-enable$sudo ln -s ../sites-available/graphite-vhost.conf   graphite-vhost.conf 
Initialize Database

InitializationgraphiteRequired database, modifystoragePermission, which is created by copyinglocal_settings.pyFile (in the middle, you will be asked if you want to create a superuser, select no, and change <User Name> to your current Ubuntu user name to allow carbon to write data to the whisper Database, in fact, users can also be specified in carbon. Update: graphite requires admin permission to create User Graph. Therefore, superuser is very important. You can use python manage. create py createsuperuser ):

$ Cd/opt/graphite/webapp/graphite/$ sudo python manage. py syncdb $ sudo chown-R <User Name>: <User Name>/opt/graphite/storage/$ sudo cp local_settings.py.example local_settings.py $ sudo/etc/init. d/apache2 restart # restart apache

The username in the above Code isApacheCorresponding user, generallywww-data, Which can be obtained using the following code:apacheOfwebRoot directory (default: var/www/html)control.php

<?php    echo exec("whoami");?>
  • 1

Access through a browserhttp://localhost/control.phpYou can see the corresponding user name

Start Carbon
$ cd /opt/graphite/$ sudo ./bin/carbon-cache.py start

Access http: // localhost: 8008 in the browser. The following page shows that the configuration is successful.

If there is an error page with no access permission, you can modify it.ApacheIn the configuration file/etc/pache2/apache2.conf, locate the location in, comment out Require all denied, and restartApacheAccess again.

Modify GraphiteDefault Time Zone

Open/opt/graphite/webapp/graphite/setting. py and findTIME_ZONEThe default value is UTC and is changed to Asia/Shanghai.
And then findUSE_TZIf not, add it at the end of the file and set it to True.

Send data graphite

There are many ways to send Data. For details, refer to the official Feeding In Your Data documentation. In addition, you can use the/opt/graphite/examplesSocketSample examples-client.py for sending data.

Graphite official documentation: Graphite official documentation

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.