Grafana, Graphite, Carbon, and Collectd installation and configuration on Debian and Ubuntu

Companies employ tools to collect and show analytical data in graphical form (tables, charts, etc.). The Grafana system with extra modules is one of the representations. Let’s take the example of deploying services on Debian and server systems.

preliminary stage

Make a new user and give him administrator privileges:

adduser graphite
usermod -aG sudo graphite

The installation is carried out under the account graphite.

Installation

Install the Graphite program, together with any plugins and other packages. and are two examples:

sudo apt-get install build-essential
sudo apt-get install graphite-web
sudo apt-get install graphite-carbon
sudo apt-get install python-dev
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
sudo apt-get install libpq-dev
sudo apt-get install python-psycorg2

Important!While a notification concerning the joint loss of information when removing the Graphite application displays on the screen, choose No.

A specialist service is required to monitor performance indicators. Carbon, in our situation. was implemented in the previous step, and now we will make changes. Let’s open the configuration file in Geany text editor – the path is highlighted in yellow. Including a block:

[collectd]
priority = 100
pattern =^collectd.*
retentions = 60s:7d,10m:2y

Important! The operation can be performed only through sudo.

The retention data are now stored in the collected block for seven days for 60 seconds.

Let’s add Carbon cache loading to the list of permitted services. Enter:

sudo vi /etc/default/graphite-carbon

Find the line CARBON_CACHE_ENABLED and set it to true. Save the changes, and close the editor. Restart the carbon-cache service for the changes to take effect.

Install the PostgreSQL system to interact with the monitoring system. Let us create a new account that will have to the Graphite database:

sudo su - postgres
createuser graphite –pwprompt

The software will prompt you to generate a key for the account name. Following the recommendations, we came up with it: at least nine characters, including , letters, numerals, and varied cases.

Add the following user to the dashboard database and web interface:

createdb -O graphite graphite
createdb -O graphite grafana

Let’s go back to the user and start customizing Graphite.

su – graphite

Apache configuration

Open the configuration template in the vi editor.

sudo vi /etc/graphite/local_settings.py

Locate the DATABASES section. Enter a new account name in the USER line (graphite). Enter the following password in the PASSWORD line:

Next, add:

TIME_ZONE = 'Europe/Moscow'
SECRET_KEY = 'somelonganduniquesecretstring'

Depending on the location of stay, the TIME ZONE field is filled in. We’ll use Moscow time as an example.

Forwarding ports to gain access:

sudo iptables -A INPUT -p tcp --dport 5432 -j ACCEPT

Save the edits:

sudo iptables-save

Restart the PostgreSQL service.

To avoid problems in the future, we will activate two commands.

python /usr/lib/python2.7/dist-packages/graphite/manage.py migrate auth
python /usr/lib/python2.7/dist-packages/graphite/manage.py migrate

Activate the database with new parameters:

sudo graphite-manage syncdb

Important! In some circumstances, information about the new Django user must be entered after the database has been established. When inputting data, follow the wizard’s directions.

The following step is to set up Apache for the monitoring system. First, we move the configuration from Graphite to Apache.

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

Now, let’s make some adjustments with the Geany text editor:

We enter data into the database management system:

sudo vi /etc/apache2/ports.conf

We locate the line Listen 80 and add Listen 8080 to it. Save the data and then exit the setting.

Deactivate the Apache web resource that is required by the standard:

sudo a2dissite 000-default

After we initiate the site of the monitoring system:

sudo a2ensite apache2-graphite

Restart the DBMS service for the changes to take effect.

Grafana setup

We connect to Ubuntu Server, and download the latest release of Grafana. As of 08/16/2019, 6.3.3 is relevant.

wget https://dl.grafana.com/oss/release/grafana_6.3.3_amd64.deb

At the end of the download – install the distribution.

sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_.6.3.3_amd64.deb

We activate the service to further configure the utility for tasks through the start command.

Important! After starting the service, a process will appear in the OS running under the grafana username. It appears after installation.

Let’s start by forwarding ports.

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables-save

Now let’s change the grafana.ini configuration to work with PostgreSQL. We open it. Find the Database section, add the following information:

In our example, the fields take the following values. Type – database type (postgres), name – database name (grafana). Enter user data: user – name (graphite), password – password.

Important! In the screenshot, the characters xxx are indicated instead of the password.

We also make changes in the server and security sections:

Screenshot #6. Correcting blocks.

We start the proxy for the Apache DBMS:

sudo a2enmod proxy proxy_http xml2enc

Let’s create a template to send requests through a proxy to Grafana. Open apache2-grafana.conf through the vi editor.

We add the following information:

We change the “IP-adr” line to the digital address of the Ubuntu server, and in the Server name field, you can specify not only the IP, but also the name.

Activate Grafana options:

sudo a2ensite apache2-grafana

Set the start time of the “Monitoring Panel” service after the OS starts, and then start the service via start:

sudo update-rc.d grafana-server defaults 95 10

Restart Apache DBMS.

Configuring Collected

First, let’s install the package:

sudo apt-get install collectd collectd-utils

Now let’s stop the service in order to make adjustments to the configuration through the stop command.

1) Open the collectd.conf file through the editor.

Find the line Hostname “localhost” and activate it (delete the commented out characters). Now we find the Plugin write_graphite block and perform similar operations.

2) Restart the service.

How to add charts

The last step is adding charts in the Grafana admin panel. Open the utility through the browser and log in.

Important! IP-address, login and password are specified in the “Grafana setup” section.

1. Open the top menu Data Sources, item Add. In the first block, the name field – we come up with an arbitrary name (in our example, the name My is used), and in the second field we specify Graphite.

2. Go to the HTTP Settings block. Add http://localhost:8080 to the URL field:

3. Go back to the menu. Select Dashboards, section New. Switch to Graph mode.

4. In the Metrics section, specify the source from which the data is taken for plotting and click OK.

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!