Ubuntu14.04 install the graphical monitoring tool Graphite

Source: Internet
Author: User
Tags rabbitmq
What is Graphite? First, let's take a look at how Graphite is a Python-written web application using the django framework. Graphite is used to collect all the server's real-time statuses, user request information, and Memcached hit rate, the status of the RabbitMQ Message Server, the load status of the Unix operating system, and the Graphite server requires 4800 update operations every minute. Graphite adopts simple text protocol and drawing function. raphite?

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 don't need to install it again. You only need to ensure that the version is greater than or equal2.6You can. 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/Opt/graphiteDirectory

Then usePipInstallpytzFor conversionTIME_ZONE, Which will be introduced later

$ sudo pip install pytz
Configuration graphite

Enter/Opt/graphite/confDirectory.Example 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/Etc/apache2/sites-availableFolder

$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:

In/Etc/apache2/sites-enableCreate a soft link to the configuration file

$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. <用户名> Change it 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 permissions 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
  <用户名>
   
:
   <用户名>
    
/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) Wearcontrol.php


  
  • 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

AccessHttp: // localhost: 8008. The following page indicates 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 the file and comment it out.Require all deniedAnd then restartApacheAccess again.

Modify GraphiteDefault Time Zone

Open/Opt/graphite/webapp/graphite/setting. py, FindTIME_ZONEThe default value isUTC, Change itAsia/Shanghai
And then findUSE_TZIf not, add it at the end of the file and set itTrue.

Send data graphite

There are many ways to send Data. For details, refer to the official Feeding In Your Data documentation./Opt/graphite/examplesProvided a passSocketExample of sending dataExamples-client.py.

Graphite official documentation:Graphite official documentation

CentOS 5.5 install Graphite http://www.linuxidc.com/Linux/2013-06/86597.htm

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-08/122435.htm

Related Article

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.