Ubuntu 14.04 Installation Graphical monitoring tool graphite

Source: Internet
Author: User

What is graphite?

First look at how Baidu Encyclopedia is introduced

Graphite is a python-written web application, using the Django Framework, Graphite used to collect all the server's immediate state, user request information, memcached hit rate, rabbitmq the status of the message server, The load state of the UNIX operating system, the graphite server needs to be updated approximately 4,800 times per minute, and the graphite is easy to use on any operating system using a simple text protocol and drawing capabilities.

Baidu Encyclopedia is more clear, Graphite is used to monitor the system, such as operating system, cache service system, but how to get the monitoring data? is Graphite not responsible, it is only responsible for displaying, the data where people do not care, you just follow his data format to it, you Graphite can wit the beautiful page display to you, but do not worry, graphite the installation of a series of kits, provides the data to send API it, And we don't have to worry about how the data is stored, just send the data to it. That's so good, how to install it?

First of all, things are not so perfect, Graphite not support windows , so for the only use Windows of Coder a little lost, but it doesn't matter, I believe that as programmers are there are ways, these are small things.

Enter Graphite the world below!

Installation

Operating system: Ubuntu 14.04
python:2.7.6

Installation graphiteThe environment

GraphiteThe required support environment is 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 is:
* Apache with Mod_wsgi
* Gunicorn with Nginx
* Uwsgi with Nginx

Ubuntuhas been installed python , so do not need to install and install, only to ensure that the version is greater than or equal to 2.6 . Here we select the server Apache , if it is installed, you do not have to install, only to install the Wsgi module libapache2-mod-wsgi .
Here are the commands for installing all of the supported environments, and we recommend one installation to see whether each installation is successful or not.

$sudo apt-get update$ sudo apt-get install apache2 libapache2-mod-wsgi python-django python-twisted python-cairo python-pip python-django-tagging
Installation GraphiteThree main components
    • Whisper (Database)
    • Carbon (monitoring data, default port 2003, external program STATSD through this port, to graphite to transport sampled data)
    • Graphite-web (Web UI)

Use pip the command to quickly install

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

Default in /opt/graphite directory after installation is complete

Then use Pip pytz the installation, which TIME_ZONE is used for the conversion, which is described later

sudo pip install pytz
Configuration graphite

Enter the /opt/graphite/conf directory, using the givenexample配置

cp carbon.conf.example carbon.confcp storage-schemas.conf.example storage-schemas.confcp graphite.wsgi.example graphite.wsgi  
For apacheAdd to GraphiteThe virtual host

The installation graphite will generate a /opt/graphite/example folder, there is a configured virtual host file, copy it to place the Apache virtual host configuration file, the default 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 to modify the listening port to 8008 and a wsgisocketprefix, as follows:

Create a soft link to the configuration file under /etc/apache2/sites-enable

$cd /etc/apache2/sites-enable$sudo-s../sites-available/graphite-vhost.conf   graphite-vhost.
Initializing the database

Initialize the graphite required database, modify storage the permissions, create the file in a copy local_settings.py (middle will ask if you want to create a superuser, choose No, < username > change to your current Ubuntu username, This is to let carbon have permission to write to whisper database, in fact carbon inside can also specify the user's, update: Graphite need admin permission to create user Graph, so superuser is very important, you can use Python manage.py Createsuperuser created):

$ 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  #重启apache

The user name in the above code is the Apache corresponding user, generally www-data , can be obtained by using the following code, in apache the web root directory (default:var/www/html) wearing piecescontrol.php

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

In browser access http://localhost/control.php , you can see both the corresponding user name

Start Carbon
cdsudo ./bin/carbon-cache.py start

At this time in the browser access to http://localhost:8008, see the following page description of the successful configuration

If there is no access error page, you can modify the Apache configuration file/etc/pache2/apache2.conf, locate the location in, comment out Require all denied , and then restart the Apache access again.

Modify GraphiteThe default time zone

Open /opt/graphite/webapp/graphite/setting.py, find TIME_ZONE , default is UTC, modify it to Asia/shanghai
And then find USE_TZ , without the words themselves added at the end of the file, set to True.

Send data to graphite

The method of sending the data is more, section one reference official document feeding in Your data, and in addition, in /opt/graphite/examples provided a copy by Socket sending data example examples-client.py.

Graphite Official documents:Graphite Official documents

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Ubuntu 14.04 Installation Graphical monitoring tool graphite

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.