Ubuntu14.04 install the graphical monitoring tool Graphite

Source: Internet
Author: User

Ubuntu14.04 install the graphical monitoring tool Graphite
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. Graphite is used to monitor systems, such as operating systems and cache service systems. But how can we obtain the monitoring data? Graphite is not responsible. It is only responsible for displaying where the data comes from. You only need to give it the data format, and Graphite can show it to you on a beautiful page, but don't worry, graphite's installation of a series of suites provides APIs to transmit data to it, and we 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, Graphite does not support windows, so it is a little lost for Coder that only uses Windows, but it doesn't matter, I believe there is a way as a programmer, these are all small things.

Next we will enter the world of Graphite!

Install

Operating System: Ubuntu 14.04
Python: 2.7.6

Install graphite Environment

Graphite requires the following support environments:
* 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

Python has been installed in Ubuntu, so you do not need to install it again. You only need to ensure that the version is later than or equal2.6You can. Here we choose Apache server, if you have installed it, you do not need to install, just install 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 Graphite Components Whisper (database) carbon (monitoring data, default port 2003, external program StatsD transmits sample data to Graphite through this port) graphite-web (web UI)

You can use the pip command to quickly install

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

After the installation is complete/Opt/graphiteDirectory

Use Pip to install pytz to convert TIME_ZONE.

$ sudo pip install pytz
Configure graphite

Enter/Opt/graphite/confDirectory, use the 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 
Add a Graphite VM to apache

When graphite is installed, a/opt/graphite/example folder is generated, which contains a configured VM file, which is copied to the location where Apache is placed in the VM configuration file. The default 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

Initialize the database required by graphite, modify the storage permission, and create the local_settings.py file by copying the file (you will be asked if you want to create a superuser, select no, change <User Name> to your current Ubuntu user name to allow carbon to write data to the whisper Database. In fact, you can also specify the user name in carbon. Update: graphite requires the admin permission to create the 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 user name in the above Code is the user corresponding to Apache, generally www-data, which can be obtained using the following code, in the apache web root directory (default:Var/www/html) Control. php

 

Access http: // localhost/control. php In the browser and you 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 an error page is displayed, you can modify the Apache configuration file/etc/pache2/apache2.conf, locate the location, and comment outRequire all deniedAnd then restart Apache to access the service again.

Modify the default time zone of Graphite

Open/Opt/graphite/webapp/graphite/setting. py, Find TIME_ZONE. The default value isUTC, Change itAsia/Shanghai
And then find USE_TZ. If not, add it at the end of the file and set itTrue.

Send data to graphite

There are many ways to send Data. For details, refer to the official Feeding In Your Data documentation./Opt/graphite/examplesThe following example shows how to send data through a Socket:Examples-client.py.

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.