Course + Grafana + Handbook + Classes + 1 To 9
Course + Grafana + Handbook + Classes + 1 To 9
PRESENTATION
Hello!
Thank you for accessing this booklet produced by NOTO TI. Before you begin,
I would like to make a brief presentation so that you can know the origins of this.
project.
A NOTO TI emerged in the city of Jaraguá do Sul, Santa Catarina, in 2016, being
result of my experience in the sector. My name is Evandro José Zipf, I have been
mais de 18 anos no ramo de redes de computadores. Além disso, possuo Certificado
Zabbix Specialist e Professional, e ampla bagagem em Linux, Cloud Computing (AWS)
the Firewall.
nototi.com.br
Grafana Course 3
Lesson 1: Installation
What is Grafana?
Grafana is an open source suite for real-time metric visualization and analysis through
of graphs, which allows to alert, consult and understand relevant information stored in
various locations. This way, you can monitor data using a single, intuitive interface, and
complete and streamline decision-making.
Package installation
nototi.com.br
Grafana Course 4
wgethttps://dl.grafana.com/oss/release/grafana-7.3.1-1.x86_64.rpm
nototi.com.br
Grafana Course 5
Important: Starting from version 7 of Grafana, it is necessary to allow plugins that are not
killed. To do this, pass the name of the plugin inside the Grafana configuration file. See
how to do:
nototi.com.br
Grafana Course 6
# tail -f /var/log/grafana/grafana.log
Add the user to the Docker group (optional) - run Docker with another user
2
# sudo usermod -aG docker noto
nototi.com.br
Grafana Course 7
Create the volume first. This way, the container's data remains persistent even if it is
removed. Do:
4
# docker volume create grafana-storage
# docker run -d \
-p 3000:3000 \
--name=grafana \
GF_SERVER_ROOT_URL=http://grafana.noto.local
5 GF_SECURITY_ADMIN_PASSWORD=noto
GF_INSTALL_PLUGINS=alexanderzobnin-zabbix-app
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=alexanderzobnin-zabbix-
datasource
--restart unless-stopped \
-v grafana-storage:/var/lib/grafana \
grafana/grafana:7.2.0-ubuntu
# docker container ls
nototi.com.br
Grafana Course 8
nototi.com.br
Grafana Course 9
nototi.com.br
Grafana Course 10
Ready! Now, to access, check the IP address of the server you installed it on.
Grafana.
To access Grafana, open a browser of your choice and type the URL:
http://seuip:3000.
2
In my case, it goes like this:
nototi.com.br
Grafana Course 11
User: admin
Password: admin
3
You will be asked to register a password for the admin. Please enter one of your own.
preference.
nototi.com.br
Grafana Course 12
6 Click enable
7 Access the data source and click on add new data source
nototi.com.br
Grafana Course 13
nototi.com.br
Grafana Course 14
Settings:
Name = Give a name to the data source of your choice
9
HTTP:
URL = http://localhost/zabbix/api_jsonrpc.php
Observations:
1. The URL you should use according to the default installations of Zabbix is ip/zabbix.
2. I am assuming that you installed Grafana on the same machine where Zabbix is.
If you have installed Zabbix on another machine in your network, change localhost in the URL to the IP.
from your Zabbix. Example:http://ipdoseuzabbix/zabbix/api_jsonrpc.php
After filling in the fields above, register a username and password to connect to the API.
Zabbix.
Attention: Remember that here you need to enter the username and password of your Zabbix, and not of
Grafana. I chose the userAdmin of Zabbix. You can use any other.
10
Zabbix API details:
username: Admin
senha: zabbix
Click on Save and Test, if everything goes well, your Zabbix is already integrated with the
11 Grafana.
nototi.com.br
Grafana Course 15
https://grafana.com/docs/grafana/latest/administration/cli/
Next...
nototi.com.br
Grafana Course 16
nototi.com.br
Grafana Course 17
So, let's set this up: create a new MySQL data source.
Here you need to pass the credentials to connect to the Zabbix database.
you can use the same user created during the software installation, however, for security reasons, it is
it is recommended to create a read-only user access to the database. Do the following:
nototi.com.br
Grafana Course 18
Ready! Open the settings of the MySQL data source and enter these credentials
Host=localhost:3306
Database=zabbix
4 User=grafana
Password=suasenha
nototi.com.br
Grafana Course 19
Now, edit the existing Zabbix data source, enable the direct connection to the database
5 data from Zabbix through its plugin.
nototi.com.br
Grafana Course 20
nototi.com.br
Grafana Course 21
Done! The heavier queries can now be performed directly on the database.
7 data, and not through an API.
nototi.com.br
Grafana Course 22
nototi.com.br
Grafana Course 23
In this lesson, you will learn how to create a dashboard for servers within Grafana.
Thus, you are already getting familiar with the software panels. Below is the screen that we will create.
Ato follow...
nototi.com.br
Grafana Course 24
nototi.com.br
Grafana Course 25
Imagine a structure with 100 servers and having to create a dashboard for each one.
visualize the same things. And, after everything is ready, have to update them all because of
a small modification... It’s a waste of time and money, don’t you agree?
For this, we will take the same dashboard from the last class. Look:
I will give an example with two Linux servers that I have inside my lab.
only for testing. Their names: Linux01 and Linux02, and these servers are in the group of
host of Zabbix called GRAFANA.
nototi.com.br
Grafana Course 26
2 Go to Variables
nototi.com.br
Grafana Course 27
nototi.com.br
Grafana Course 28
Go back to the dashboard screen and notice that the two variables have been created in the corner.
6 superior.
nototi.com.br
Grafana Course 29
Notice that the variable $grupon was added to group and the variable $host to host.
Do this for all memory components, processor, etc. After completing this
procedure, the automation is ready.
8
Alternate between the hosts, in my case Linux01 and Linux02, and see the automation in
functioning.
Next class:
nototi.com.br
Grafana Course 30
nototi.com.br
Grafana Course 31
We will also create the group and host variables. Pay attention to the detail:
1 Multi-value
Include All option
nototi.com.br
Grafana Course 32
Click on Update. Then, edit all components and select the repeat option.
2 each of them. Use the variable host as a reference.
Once the previous step is completed, just test the repetition of the components by selecting each one.
3 host in the variable host
nototi.com.br
Grafana Course 33
6 Note that the name of each host is in the title of the component.
nototi.com.br
Grafana Course 34
nototi.com.br
Grafana Course 35
nototi.com.br
Grafana Course 36
Another interesting option is the use of row to separate the components within the
dashboard. With this, you can hide or show the data you want to have on the screen. Let's go to the
examples!
nototi.com.br
Grafana Course 37
Click on Update
4 Ready! Select one or more hosts and see the result. Also note that now you
There is an option to hide/show data by host.
Check out: Class 7 - Regex and Functions, and take your monitoring to the next level with Grafana!
nototi.com.br
Grafana Course 38
nototi.com.br
Grafana Course 39
Without treatment
With treatment
nototi.com.br
Grafana Course 40
nototi.com.br
Grafana Course 28
Go back to the dashboard screen and notice that the two variables have been created in the corner.
6 superior.
nototi.com.br
Grafana Course 42
2 Three variables appeared within the dashboard. See how the partition one is.
3 Okay, but I only want to leave the partition; I don't want used disk... Learn how to do it:
We use regex to replace and keep only the partition name. The () and the .* replace
4 all text only by what is inside the parentheses. See now how it turned out:
nototi.com.br
Grafana Course 43
We still need to make one last adjustment to the Query; it is also necessary to add a regex.
5 inside her.
nototi.com.br
Grafana Course 44
Now it's ready! Do the tests by selecting the hosts and partitions.
Attention: Hey! What if I want to create the partition charts separated by Used and Free,
Do I have to do it one by one? No! Find out how:
nototi.com.br
Grafana Course 45
9 Ready! Now, just test it. Take a look at how it turned out:
nototi.com.br
Grafana Course 46
nototi.com.br
Grafana Course 47
In the same dashboard we did before, create two rows: one called DISCO
1 and another, NETWORK, leaving it as shown in this image:
2 Create one more variable called interface, as shown in the screen below:
nototi.com.br
Grafana Course 48
Leave:
Group =$grupo
host =$host
Application =Network Interfaces
3 item =/.*/
Incoming network traffic on (.*)
nototi.com.br
Grafana Course 49
Take the opportunity to insert the variable in the component title. Therefore:
nototi.com.br
Grafana Course 50
It's time to test! Use a host that has more than one network interface. See my
5 example environment:
nototi.com.br
Grafana Course 51
nototi.com.br
Grafana Course 52
Next class to elevate the level of your services: Mathematics with Grafana
nototi.com.br
Grafana Course 53
nototi.com.br
Grafana Course 54
We have some other functions and a new option in Grafana version 7, which is the part of
Transforms.You will learn to calculate data and/or transform it.
1 Imagine that you want to add the load of 1 minute with 5 and 15 to have a total. Look:
nototi.com.br
Grafana Course 55
"1m" means that I want to sum the data in the range of 1m. This is the time.
to update the load items in Zabbix. I used a regex to capture everything that
for item load, that's why the /load/.
4 Note that there are other functions: average, max, min, etc.
You can sum from any data. Let's practice with network interface. Check it out.
5 to follow...
nototi.com.br
Grafana Course 56
6 I want to sum the incoming and outgoing traffic and put the name of the aggregate.
Result:
nototi.com.br
Grafana Course 57
8 Your client requested a separate network graph dashboard + the aggregate, but
he has several servers and/or equipment, and he doesn't want to do it one by one, he wants
something practical and automated.
Xiiiiiiii! Complicated?! Calm down, it will be fine. So, practice, try to do it without watching the
next class, in which we will show the step by step with all the commands and tips.
Agreed? Good luck and see you then!
nototi.com.br
Curso Grafana 58
CLOSING
A NOTO TI thanks you for accessing this manual. And don't forget to
also follow our channels on digital media. Feel free to join
in contact, clarify doubts and check new content that NOTO TI provides
often.
Hug
nototi.com.br