How to Install and Configure Graphite on Ubuntu 16.04

Graphite is a free and open source tool that can be used to track and graph the performance of computer systems. Graphite is an application that can be used to gather information from your system and display it through its web interface.

In this tutorial, I will explain how to install and configure Graphite on Ubuntu 16.04.

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 server instance.
  • A non-root user with sudo privileges setup on your server.
  • A static IP address 192.168.0.227 configured on your system.

Step 1: Update the system

First, update your system to the latest stable version by running the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is updated, restart your system to apply these changes:

sudo reboot

Step 2: Install Graphite

Graphite is made up of several components including, the graphite web application, carbon storage backend, and the database library, whisper. Each of these components are available in Ubuntu default repository. You can install these by just running the following command:

sudo apt-get install graphite-web graphite-carbon -y

Once the installation is complete, you can proceed to the next step.

Step 3: Install and configure PostgreSQL

The Graphite web application is a Django Python application that needs PostgreSQL to store its data. You can install PostgreSQL and the helper packages by running the following command:

sudo apt-get install postgresql libpq-dev python-psycopg2 -y

After installing PostgreSQL, you will need to create a PostgreSQL user and database for Graphite to use.

First, login to PostgreSQL shell with the following command:

sudo -u postgres psql

Next, create a graphite user and secure it with a password:

postgres=# CREATE USER graphite WITH PASSWORD 'password';

Next, create a graphite database and give ownership to the graphite user:

postgres=# CREATE DATABASE graphite WITH OWNER graphite;

Finally, exit from the PostgreSQL shell:

postgres=# \q

Step 4: Configure Graphite

Once the database is setup properly, you will need to configure the Graphite web application. You can do this by editing the local_settings.py file:

sudo nano /etc/graphite/local_settings.py

Edit the file as shown below:

SECRET_KEY = 'your-secret-key'
TIME_ZONE = 'America/Los_Angeles'
USE_REMOTE_USER_AUTHENTICATION = True
DATABASES = {
    'default': {
        'NAME': 'graphite',
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': 'graphite',
        'PASSWORD': 'password',
        'HOST': '127.0.0.1',
        'PORT': ''
    }
}

Save and close the file, when you are finished.

Next, run the following command to sync the database to create the correct structure:

sudo graphite-manage migrate auth
sudo graphite-manage syncdb

You will be asked to create a superuser account for the database as shown in the following output:

Operations to perform:
  Synchronize unmigrated apps: account, cli, render, whitelist, metrics, url_shortener, dashboard, composer, events, browser
  Apply all migrations: admin, contenttypes, tagging, auth, sessions
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  No migrations to apply.

You have installed Django's auth system, and don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): 
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.

Step 5: Configure Carbon

Now, you will need to configure Carbon, the Graphite storage backend by editing the service configuration file, graphite-carbon.

sudo nano /etc/default/graphite-carbon

Change the file to enable carbon-cache to start on boot:

 CARBON_CACHE_ENABLED=true

Save and close the file, when you are finished.

Next, open the Carbon configuration file:

sudo nano /etc/carbon/carbon.conf

Change the file as shown below to enable log rotation:

ENABLE_LOGROTATION = True

Save the file, then configure storage schemas. To do so, edit the storage schema file to tell Carbon how long to store values and how detailed these values should be there:

sudo nano /etc/carbon/storage-schemas.conf

Add the following section at the end of the file:

[test]
pattern = ^test\.
retentions = 6s:4h,1m:1d

Save and close the file when you are finished.

Next, you will need to define the way you want aggregation to occur in a file called storage-aggregation.conf. Copy the example configuration file to the Carbon configuration directory:

sudo cp /usr/share/doc/graphite-carbon/examples/storage-aggregation.conf.example /etc/carbon/storage-aggregation.conf

Finally, start Carbon service with the following command:

sudo systemctl start carbon-cache

Step 6: Configure Apache for Graphite

You will also need to install the Apache web server to use the Graphite web interface. You can install Apache with the following command:

sudo apt-get install apache2 libapache2-mod-wsgi -y

Next, copy the graphite example configuration file to Apache with the following command:

sudo cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available/

Once the installation is complete, disable the default virtual host file and enable the graphite virtual host file with the following command:

sudo a2dissite 000-default
sudo a2ensite apache2-graphite

Finally, restart the Apache service to apply these changes:

sudo systemctl restart apache2

Step 7: Access Graphite web interface

Next, You will need to allow port 80 through UFW firewall to access the Graphite web interface. You can do this by running the following commands:

sudo ufw allow 80

It's time to access Graphite web interface. Open your favorite web browser and type the URL http://192.168.0.227. Then, provide your login credentials (your root username and password), you will see the Graphite login screen.


Masinate tõus: AI tegelikud rakendused

Masinate tõus: AI tegelikud rakendused

Tehisintellekt ei ole tulevik, see on siin, olevikus. Sellest blogist loe, kuidas tehisintellekti rakendused on mõjutanud erinevaid sektoreid.

DDOS-i rünnakud: lühike ülevaade

DDOS-i rünnakud: lühike ülevaade

Kas olete ka DDOS-i rünnakute ohver ja olete segaduses ennetusmeetodite osas? Oma päringute lahendamiseks lugege seda artiklit.

Kas olete kunagi mõelnud, kuidas häkkerid raha teenivad?

Kas olete kunagi mõelnud, kuidas häkkerid raha teenivad?

Võib-olla olete kuulnud, et häkkerid teenivad palju raha, kuid kas olete kunagi mõelnud, kuidas nad sellist raha teenivad? arutleme.

Googlei revolutsioonilised leiutised, mis muudavad teie elu lihtsaks.

Googlei revolutsioonilised leiutised, mis muudavad teie elu lihtsaks.

Kas soovite näha Google'i revolutsioonilisi leiutisi ja seda, kuidas need leiutised muutsid iga inimese elu tänapäeval? Seejärel lugege ajaveebi, et näha Google'i leiutisi.

Reede oluline osa: mis juhtus tehisintellektiga juhitavate autodega?

Reede oluline osa: mis juhtus tehisintellektiga juhitavate autodega?

Isejuhtivate autode kontseptsioon tehisintellekti abil teedele jõudmiseks on meil juba mõnda aega unistus. Kuid vaatamata mitmele lubadusele pole neid kusagil näha. Lisateabe saamiseks lugege seda ajaveebi…

Tehnoloogiline singulaarsus: inimtsivilisatsiooni kauge tulevik?

Tehnoloogiline singulaarsus: inimtsivilisatsiooni kauge tulevik?

Kuna teadus areneb kiiresti, võttes üle suure osa meie jõupingutustest, suureneb ka oht, et allume seletamatule singulaarsusele. Loe, mida singulaarsus meie jaoks tähendada võiks.

Andmesalvestuse areng – infograafik

Andmesalvestuse areng – infograafik

Andmete säilitamise meetodid on arenenud alates andmete sünnist. See ajaveeb käsitleb infograafiku alusel andmete salvestamise arengut.

Suurandmete viitearhitektuuri kihtide funktsioonid

Suurandmete viitearhitektuuri kihtide funktsioonid

Lugege ajaveebi, et kõige lihtsamal viisil teada saada Big Data Architecture'i erinevaid kihte ja nende funktsioone.

6 hämmastavat eelist nutikate koduseadmete olemasolust meie elus

6 hämmastavat eelist nutikate koduseadmete olemasolust meie elus

Selles digipõhises maailmas on nutikad koduseadmed muutunud elu oluliseks osaks. Siin on mõned nutikate koduseadmete hämmastavad eelised, mis muudavad meie elu elamisväärseks ja lihtsamaks.

macOS Catalina 10.15.4 täienduse värskendus põhjustab rohkem probleeme kui lahendamine

macOS Catalina 10.15.4 täienduse värskendus põhjustab rohkem probleeme kui lahendamine

Hiljuti andis Apple välja macOS Catalina 10.15.4 täiendusvärskenduse probleemide lahendamiseks, kuid tundub, et värskendus põhjustab rohkem probleeme, mille tulemuseks on Maci masinate tellimine. Lisateabe saamiseks lugege seda artiklit