Grafana
Query
Visualize
Alert
Grafana Open source
Support all major databases - in same dashboard
Dynamic dashboard & Filters
Explore Metrics and logs
Alerting
Version - 7.4.2
Grafana - is visualization tool, it doesn't store in it,
we need 1 data store for it
Default Port 3000
Telegraf - Collect System Data - its database that collect system related data. we will put it on server where collect data like system Metrics, like cpu utliz., memory utilz, etc
InfluxDB - Store System Data(with timestamp) telemetry database - it will basically collect data that send by telegraf
Grafana - Visualizes Data, and data collected in InfluxDB, we can create beautiful database using Grafana,
Steps to download Grafana
go to https://Grafana.com/grafana/download
Install Influx DB
https://influxdata.com/influxdb/v1.8/introduction/install
Telegraf
https://influxdata.com/influxdb/v1.17/introduction/install
Configure Telegraf
/etc/telegraf/telegraf.conf
uncomment
urls = ["http://127.0.0.1:8086"]
restart telegraf service
for explore Grafana dashboard feature visit below link
https://www.youtube.com/watch?v=E6Me2slK6zk
grafana full course
https://www.youtube.com/watch?v=CMvOekuOvSo
If you have so many dashboards you can search from Search bar
+ - from plus Can create new dashboard
Import you can import already created dashboard.
Panel
Part of dashboard, a dashboard is collection of multiple panel.
Dashboard Settings
Here you can add your variables,
Dashboard setting its only work for your current dashboard
If you have 5 different dashboard,
then you can do 5 different setting for each dashboard.
filter key option - time frame
zoom-in zoom-out
Refresh time
Folder - In folder we can put different dashboard according to use
import
if you want to import dashboard, can use import dashboard.
Folder - In folder we can put different dashboard according to use
Explore - It will use when you use diff data sources and query.
Alerting - When create new alert, like cpu util more then 80%
you want alert on telegram and email, we can use diff
Notification channels
Current User login
Preferences from main user change for all user, Preferences from user, only chane for that particular user.
InfluxDB will store all data, and we connect grafana with influxDB,
influxDB integrate with grafana
Settings - Configuration - Data Source
To check data reached in InfluxDB
go to server
type influx - influx cli will open
> show databases;
name: databases
telegraf
> use telegraf;
> show measurements;
cpu
disk
diskio
kernel
mem
processes
swap
system
>
its telemetry database, it will keep data with timestamp
Telegraf is agent on client machine who sending data to influxDB database.
>select * from cpu limit 5;
Connect data source to Grafana
Go to web Ui
settings - Configuration - Add data source
choose your data source from the list
In HTTP we can define where is our Data source(influxDB).
Database - telegraf
Save & Test
Create Panel
Go to Panel
in Panel setting you have data Source option if you have more then 1 data source you can select even multiple data source also.
after Database selection
Query Build
In grafana we can create multiple query
From - default (selection option like telegraf) - use default only
Select measurement - (seen in cli like cpu, disk,kernel etc)
select field - (usage_system, usage_idle, usage_nice etc)
create panel for CPU util.
same way now create for mem. util.
create uptime dashboard
convert unit into sec.
unit - into sec
decimal - 0
Thresholds - red - 80 - base - green
Create dashboard for user logged in.
From - system
Select - rt_users
visualization - stat
create panel
From - mem
Select - used_percent
Thresholds
Red - 80
Base - green
if want to add more threashold click on add threshold
max put before 100 and add value and color for the threshold.
Now Save the dashboard - give name - if want to check if dashboard available - go to - Home - Recent view dashboard - click on saved dashboard
Multi server Monitor
Install telegraf on other server also.
Create Panel
From - cpu
Select - usage_system
it will show combin value if not selected group by
so select group by
Group by - + click - tag(host)
Alias by - $tag(host) - if you want to remove tag host from the panel
Convert to Row - if you want to hide current all panel in your dashboard, you can convert to row and you can hide and unhide from the dashboard.
If you want to Rename Title - Click Row Option - Title - give name like Summary - Update
In multiple host - cpu util.
Values - Min , max, avg, current, total , we can also select -from option - can select - As table
Legend we can put on right side also
But suppose you have 100 machine,
and you want to monitor only 2-3 in all.
Go to dashboard setting
Go to variables - Add variable
Create Query
How to see all host on influxDB
$ influx
> use telegraf;
> show tag values from cpu with key=host - press enter
Create Query
Name - Servers
Label - Select A server(s)
Query - show tag values from cpu with key=host
After you select query the value in - Preview of values automatically came.
Now go back to dashboard - you get a drop down of server list.
If you want to edit - select multiple server
Edit variable - Selection Options -
Multi-value -Enable
If you want to provide All option in drop down
Edit variable - Selection Options -
Include All option -Enable
Table panel - for display data
From - processes
Select - field(Total)
group By - time(1m) tag(host)
Formate as - Table
Limit - 10
In Panel - field - go to - cell display mode - Color text
Thresholds
80 - red
base - greeen
No comments:
Post a Comment