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,Graphite
It is used to monitor systems, such as operating systems and cache service systems. But how can we obtain the monitoring data?Graphite
It 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,Graphite
You can use a pretty page to show it to you, but don't worry,graphite
A series of packages providedAPI
You 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
W is not supportedindows
ThereforeWindows
OfCoder
It is a little lost, but it doesn't matter. I believe there is a solution as a programmer. These are all small things.
EnterGraphite
World!
Install
Operating System: Ubuntu 14.04
Python: 2.7.6
Install
graphite
Environment
Graphite
The 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
Ubuntu
Already installedpython
So 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 serverApache
If 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
Graphite
Three 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)
Usepip
Command to quickly install
$sudo pip install whisper$sudo pip install carbon$sudo pip install graphite-web
After the installation is complete/Opt/graphiteDirectory
Then usePip
Installpytz
For 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
apache
Add
Graphite
Virtual Host
Installgraphite
Will generate/opt/graphite/example
Folder, which contains a configured VM file to copy itApache
Place 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
Initializationgraphite
Required database, modifystorage
Permission, which is created by copyinglocal_settings.py
File. <用户名> 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 isApache
Corresponding user, generallywww-data
, Which can be obtained using the following code:apache
Ofweb
Root directory (default:Var/www/html) Wearcontrol.php
Access through a browserhttp://localhost/control.php
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 there is an error page with no access permission, you can modify it.Apache
In the configuration file/etc/pache2/apache2.conf, locate the location in the file and comment it out.Require all deniedAnd then restartApache
Access again.
Modify
Graphite
Default Time Zone
Open/Opt/graphite/webapp/graphite/setting. py, FindTIME_ZONE
The default value isUTC, Change itAsia/Shanghai
And then findUSE_TZ
If 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 passSocket
Example 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