 So, in this session we are going to learn how to install Grafana on a Linux machine. So, in this session I am taking a reference of my article which I have written on itpanther.com which I have written on itpanther.com and if you want to see all the articles written about Grafana you can log in to this website itpanther.com and then come to Grafana section and once you do that you should be able to see all the articles which is written about Grafana. Okay, so here you can go to installing Grafana on Windows or on Linux and then you can click on read mode and then you will be able to come to the same page which I'm using. Okay, so I'll close one tab and let one tab open. Okay, so what we need to know before installing Grafana on Linux? Okay, so one important thing which we need to know is that Grafana needs one database to keep its application related database. Okay, so by default Grafana use SQLite okay that is a database which is embedded in this software so what that means is that when you are downloading Grafana and installing Grafana you don't need to download and install SQLite separately it just gets installed when you install Grafana. However, let's say for some reason you don't want to use SQLite you want to use any additional database which can be MySQL or PostPlaySQL. In that case there are some additional configuration is required so we will do those things in upcoming sessions. In this session we are just going to stick to installing Grafana in a default mode and that's why it is just going to use SQLite. Now once you install Grafana you access Grafana using a web interface. So basically it is you are going to need a browser in order to access Grafana. Okay, so the browser which can be used is Chrome, Firefox, Safari or Microsoft Edge. So it supports all the modern browsers. Okay, so whenever we are using any web-based application there are two things come into picture one is the URL and the other thing is the port. Okay, so Grafana by default is uses 3000 port. Most of the web application when you run it uses port 80 or 8080 something like that. Grafana uses 30000. So there is a good chance that if you install Grafana on the server where other web applications are also installed it is not going to clash with your other web application because they are running on a different port and this is going to run on a different port. However it is your job to ensure that you are not using this port already before installing Grafana. If you are doing that then you need to make sure that you change the port of Grafana before starting Grafana services. Okay, so we will see those things later. Now depending on the you know Linux or Unix labor you are on you can choose which a command you want to use to install. So in this case since I am on CentOS I'm going to use these commands. Okay, so now let's go to the server. I already have a server and I'm logged in as Grafana admin user and my current working directory is slash home slash Grafana admin and hostname of this server is itpan302 and if I do ls you can see right now I do not have anything stored here. Okay, so we are into slash home slash Grafana admin and this is a blank directory. There is nothing there. Okay, so now let's begin by copy pasting this command and now what this command basically does is it is going to download this RPM from dl.grafana.com website. Okay, and if you are on Unix or Linux system you already know that WGAT is the utility which you use to download anything. Okay, on a Linux system. So I will use WGAT, hit enter and let's see what happens. Oops, as you can see for some reason we are getting the error. So basically what has happened here is we do not have WGAT already installed. Okay, so if you are in the same situation like me you are also probably going to get the error some similar error and now the thing which you need to do is you need to install WGAT. So for that we are going to do sudo yum-y install WGAT. Okay, so this is the command to install WGAT and it is pretty simple. So if you do not have WGAT use this command hit enter and it is going to install WGAT. So once that is done I'm going to clear the screen and then I'm going to run the same command which we were trying previously. Okay, so WGAT followed with the RPM URL. Hit enter. This time you see downloading has started and we were able to download RPM file with 68.1 MB in size. Okay, so if I do LS-LRT this time you can see now we have Grafana RPM already on our server. So now I'm going to go back and I'm going to see the second command which is sudo yum install and we need to give path of the RPM. So here we need to copy paste the same thing and just make sure if you have downloaded any other version of Grafana just make sure when you are installing it you give the same name. So what you can do is you can just remove whatever is here and you just need to make sure whatever you have downloaded the same thing is copy pasted here. Now hit enter and it is going to install Grafana. Okay, now here it is asking for confirmation so you can press Y to continue installing Grafana and now you see some success message saying that Grafana is successfully installed and it is completed. Okay, now you see some messages here. Okay, so basically what it is saying is not starting on installation. So what it means is that by default it has installed Grafana but it has not started Grafana services. Okay, so now how do you verify whether Grafana is started or not or whether it is running or not. Now the way to do that is you can use sudo system CTL and you can use status and then you need to type this grafana-server.service. Okay, hit enter and here you can see the status that Grafana is inactive. So when you install Grafana by default it is in deactive mode. Okay, now what do you do when you need to start Grafana? Okay, so you use the same command. Let me clear the screen first. So I'll press control C and then next line I will type clear hit enter and here we will basically type the same command which we used for status and then we are going to change status to start. Okay, and then if I hit enter now I'll be able to start Grafana but before we even do that I'm going to press control C again to cancel this command. I have not run this command yet. Now the other way basically to check if Grafana is already running or not is using telnet command. So telnet command is going to tell you whether you are able to listen on a particular port. So now we know that Grafana runs on port 3000. So if I do telnet localhost 3000 basically it should be able to telnet. So it should be able to connect. Okay, and please note you will only be able to run this command if you have telnet installed. Okay, so if you do not have telnet installed it is probably going to give you some similar error which you got in case of wget. So let's hit enter and we see we are getting the similar error which we got in case of wget. So as we know the next thing which we need to do is we need to install telnet using sudo space y install telnet. Hit enter should take couple of minutes and should install telnet. So now we see telnet is successfully installed. I'm going to clear the screen and let's run telnet localhost 3000 again. Hit enter. We see we are getting error saying connection refused. Okay, so what it means is there is no service which is listening on port 3000. So that's other way of checking whether Grafana is running or not. Okay, so if you are trouble shooting or if you want to make sure that Grafana is running on any server or not, you can use this command. And if your Grafana is running on a remote server, so rather than localhost here you need to provide the actual IP address of the server. So something like this. Okay, this is how you check whether port 3000 is listening or not. All right. Let's clear the screen and this time we are going to start Grafana by using sudo system CTL start command and make sure you type grafana-server.service hit enter and it is going to start Grafana. So you have not got any message in return. You just run this command and it makes your prompt change to the next line. And now if you want to see the status you need to use status command again hit enter. And now you see it is showing it is active. So that is how you know that Grafana is running. Now let's run that telnet command again and let's see what happens this time. So now if I do telnet space localhost space 3000 hit enter. This time you see we are getting the message that connected to localhost, which means there is some service which is listening on this port. And we know that service is Grafana service. Okay, so I'm going to press control C to escape and now we can clear the screen. Okay, so now we know Grafana is going to run on the URL which is going to be your server hostname followed by port 3000. Okay, so if you do not have DNS then probably you need to use IP address. In my case I need to use IP address. So this is the IP address of this server. And I'm going to open a new tab. I will type the IP address followed with the port which is 3000 hit enter. And you should be able to see Grafana launching. If you do not see Grafana launching, it means for some reason installation was not successful and you need to further troubleshoot what went wrong with Grafana. Okay, now you see it is prompting us with an email and password. Now if you remember we haven't really set up any email or password when we installed Grafana. Okay, so what we need to do is there is a default username and password which we need to use so that default username and password is admin admin. Okay, so let's type admin password also going to be admin hit enter. And now we see it is saying we are logged in also giving us prompt to change the password. Okay, so I'm going to change the password. If you want to skip this step you can use skip but it is always a good practice after installing Grafana change the password because as you know anyone who is aware about Grafana they'll be knowing that default username and password is admin admin and they may try to you know use default admin credential and will be able to log into Grafana if you haven't changed the username and password. Okay, so basically the password which you should be changing and click on save. Now you see you are going to go to the screen of Grafana. Okay, that's how Grafana looks like when you install Grafana and access Grafana for the first time. Now I'm going back to my article so here I have also written how you can manage the services which is basically how you start, stop or check the status of Grafana services. Okay, so let's say if I want to stop Grafana so what I need to do is it is going to be the same command which you used for checking status or start starting and the only thing which you can change here is this keyword. So you change it to stop to stop Grafana. Hit enter and now Grafana is stopped. How do you verify? Now to verify you can use status. Hit enter here you should see the status is set to inactive. The other thing is when I go here if I refresh I should not be able to see this page. Okay, so I have refreshed. It is trying to connect and it is basically giving us error saying site cannot be reached because we know we have stopped Grafana services. Okay, I'm going to start it one more time and let's go back to this website of Grafana. Okay, and hit refresh. Now we see we are able to log into Grafana again. Now let's say for some reason you want to uninstall Grafana. So the step for that is if you have Grafana already running first thing probably a good advice is you stop Grafana. So now if I refresh I'll not be able to access this you know Grafana page and it is going to give us an error. Now if you want to uninstall Grafana we need to use this command. Okay, so sudo yum remove. So let me clear the screen first. Let me do ls-lrt. So if you remember this is the rpm which we had downloaded. So we need to use sudo space yum, space remove, space the rpm which we have downloaded and here we need to take out .rpm. Okay, so just take out .rpm and leave the remaining part. Hit enter and it is going to uninstall Grafana. Okay, so I'm going to hit enter and it is going to make sure that Grafana is uninstalled. It is asking for confirmation. I'm going to give y for confirmation. Now you see it has uninstalled Grafana. Now if you run command of checking status it is basically going to give you error because there is no service named grafana-server.service is running or your operating system cannot recognize anything like this. Okay, because Grafana is totally uninstalled from this server. So that's it in this session just to summarize. In this session we have learned about Grafana prerequisites like database and we also know what are the supported web browsers. Then we learned that by default it works on port 3000 and also we followed the steps to install on CentOS and then we went on logged into the Grafana by using admin-admin-credential which is the default one. We also changed the password and then we learned on how to stop or check the status of Grafana service and then we also went on to uninstall Grafana. So in your environment if you don't want to uninstall just skip this step and follow on the remaining steps. So in this session we are going to learn about installing Grafana on a Windows machine. So when you are installing Grafana on Windows there are two approaches which which are available. So approach number one is you can download MSI version of the software. So MSI is a installer. So basically you install it using the same approach which you use to install any other application on a Windows machine. So you're going to download this you double click on this and then it is going to launch the setup wizard and the second approach is installing standalone Windows library. So in this case you download the zip file and then you extract that zip file and inside that you are going to have binaries. By binaries I mean is like Grafana-sever.exe which you can then double click to launch it. So the first approach you should be following when there is no restrictions on your laptop and you have admin access and all those stuff then you can just follow the first approach and in case there is any restrictions on your laptop in terms of you know admin access or there is any organizational level restrictions then you can follow the second approach. Now by default Grafana is going to run on port 3000 and this is the same case when you install Grafana on any platform. So regardless of which platform you install it is going to by default run on port 3000. So you need to make sure that no other application is running on this port okay just make sure before installing Grafana that there is no other application which is running on this port 3000. If there is then you should be changing the port of Grafana okay so that it is not going to clash with your existing application. So now let's follow the first approach and let's begin. So I have clicked on this link and it has started downloading the software. As you can see on the left bottom side that software has already been downloaded okay so if you want to download the software you can go to itpenter.com then slash installing hyphen grafana hyphen on hyphen windows. So it is going to open up my article which tells about how to install grafana on windows machine. Otherwise if you come to itpenter.com you can go to blogs section in the blogs section then you can move on to category and then you can move to grafana and here you will see all the articles which is written about grafana. It is about installing grafana and there is a lot of other stuff. So here you can go to the article which talks about installing grafana on windows and then you are going to come to the same article which I'm showing you now and then if you click here on download grafana. So basically it is going to download the software. If you see on the top left side so it is basically pointing to you know dl.grafana.com website and it is going to download the software from there to your system. Now once you double click on this software after downloading it is going to launch the setup wizard and as you see here is the msi version sometimes give you know security warning and stuff like that because your antivirus may be blocking this but you know this is a genuine software so you should click on more info and then you are going to get option of running the software okay by default if you see you only see don't run. Now if you click on this link you can see at the top you know at the left bottom side that it is a software which is being downloaded from grafana.com which is an authentic website for grafana okay so i'm not going to click on don't run going to click on more info and then i'm going to get option of run anyway and once i click on run anyway the installation is going to begin. Now installation is very straightforward so you click on next and you need to accept the terms and license agreement click on next and then here you see the default location which is pointing to C drive. So now if you are in a production system always make sure you change the location. Since here i'm not going to change the location i'm just going to show you here you can change the location but since i'm not running on production i'm not going to change it. In your situation always make sure do not install grafana in C drive because if operating system crashes you are going to lose grafana and and you know you are you are basically going to lose all the stuff which is done in grafana. So i'm going to click on next click on install and it's going to take a couple of minutes again depending on the system resources you have available on your system. So here it has taken around 8 to 10 seconds and installation has been completed. So click on finish you are pretty much done software is installed now you should be open grafana using grafana web URL. So let's close this and now we should be able to run grafana and to do that the URL which we need to use is http colon slash less localhost colon 3000. So i'm going to copy paste this in the web browser and now you should be able to see that grafana is launching. If grafana is not launching that means there is something wrong. So you should just see what is the error message you have received during installation and then you should act based on the error messages which are shown. Now here if you see there is no email or password which we have given during installation. So what it means is there is a default username and password which is called admin admin which you need to use. So i'm going to write username admin and password also is admin and then it is going to move us to same screen actually and with the option of changing the password. So here always consider changing the password when you are not using you know whenever you are using a production server if you want to skip it you can skip it in a non-production server but always make sure you are changing it in a production system because anyone who knows grafana they also know that there is a default username and password which is called admin admin and they may try to log into grafana application. As an administrator you need to make sure that your application is secure. So i always change the password and then i move on to next step. So once you change the password you are going to see the prompt saying user password changed and this one is basically the browser stuff it is trying to save your password so you can close that. So this is how your grafana is going to look once you install and login to grafana for the first time. So in this session we are going to learn about how to change the default port when you install grafana. Okay so the step is very easy first thing is you're still going to install grafana the same way which you do if you don't need to change the port. So in this lesson also i'm going to install grafana. So i'll just quickly going to install grafana okay because we have already covered installing grafana in previous lesson. I'll just quickly install it and then i will show you what we need to do to change the port okay so the installation instruction is pretty simple it is there on the article okay just go to itpenther.com and there you can see the article and from there follow the instructions or you see the previous sessions in detail where we have discussed about this. So here you see now it says grafana setup is completed. Now the way to check whether the grafana is running or not is you need to use this command just make sure you change the start to status otherwise it is going to start grafana. We just want to see the status so i've changed it to status here we see it is showing that grafana is inactive okay so which means grafana is installed but it is currently in inactive state. Now we don't want to start grafana because we need to change the port okay so the what we need to do is we need to make changes in the grafana.ini file where all the configuration stays okay so you go to slash etc slash grafana slash grafana.ini edit it and change the port from three zero zero zero two any port of your choice just make sure that that port is not already used so here i'm going to open this in a vi editor also i put sudo in the front because if you remember we installed this software using sudo so by default all the file permission is set to root so i need to use sudo if i want to edit this file so i'm going to edit this file and then i'm going to go to the place where it shows port 3000 and then i'm going to change the port okay okay just you see it is starting with semicolon okay so make sure you change the semicolon you need to remove this if you don't remove this then your changes are not going to be accepted because by semicolon what it means is that it is a comment and also change the port to some other port so in this case i'm changing it to three zero one zero and i'm also going to remove semicolon do not forget to remove semicolon semicolon means comment in grafana.ini file so once you've done that save and exit okay so now we are going to start grafana so once you hit this command statement to start grafana after that we need to run the status command to see what is the status now it should be showing as running or active okay now you can see it is showing as active and in brackets it is showing running so yes grafana is installed and we should be able to log into grafana by specifying the complete url here along with the port which is three zero one zero so my server's ip address is this one so i'm going to use this and along with colon you need to provide the port which is three zero one zero in this case hit enter and you should be able to see grafana so in this session we are going to discuss about changing the default database of grafana application from sqlite to mysql okay so as you know by default grafana uses sqlite and let's say for some reason we don't want to go ahead with sqlite database we just want to change it to mysql database because maybe your organization follows this standard for databases so in this session we are going to discuss how to achieve this as a grafana administrator as a grafana developer i don't think it is going to be your job to install mysql so it is a general assumption that there is going to be a dba in your organization who is going to give you access of mysql and he's also going to install the required database for you okay however if you still want to see the steps of installing mysql then you can follow along i have put all the you know steps of installing mysql here so i'm just going to install mysql first and then we will discuss about making a change in the database of grafana okay so yeah let me copy all these lines one by one so these first three set of line is basically what it is going to do it is going to install mysql server okay so i had the same server which we used previously so you can check the host name and the directory and the user okay so i'm going to run these commands one by one so first command is just downloading the rpm so second command is just setting the package now we are going to install this package using yam install so as you see basically it is pretty simple we are just we fired the first three commands and then we are we accepted the you know prompt and now it is going to go ahead and download the required binaries and then it is going to install mysql and the mysql version which is it is going to download is 5.7 in this case so depending on the speed of your internet and also the system resources it can take some time okay if you are not aware actually mysql is now maria db so if you see something related to maria db and all so you just ignore it basically now mysql is also called maria db we are going to start the services of mysql server so before we do that i'm just going to use status command to see the current status okay so right now you see it is saying it is inactive so it is not started yet now we are going to follow the command to start mysql it is going to take some time and then going to start mysql okay so it is it has taken me to next prompt which means services are started so i'm just going to check the status again by using status command okay so now we see it is saying mysql service is active and it is running so that is what we wanted to see and now there is something called temporary password which mysql generates as part of sql you know initial setup and installation so i'm just going to use grep command to check that password okay so this is the default password which it has generated in your case this may be a different password and now i'm going to run these commands and going to create a database okay which grefana is going to use and also i'm going to create a user which which is going to be used by grefana okay and then we will provide this db and user related information in grefana configuration file so this first step is still part of you know mysql installation and setup so i'm just going to type this and i'm going to copy this password again because when we are setting up this mysql secure installation we it will be prompting us to enter the password so this is the password which is being generated and i copied it and then paste this sudo space mysql underscore secure underscore installation and hit enter so you see now it is asking the password of root so i'm going to give the password which i copied from here now it is asking new password so enter the new password okay the password which i have given is doesn't comply so i'm going to choose the new password so in this case okay so new password has been accepted now i'm going to change the password for root so it is asking whether do we want to you know use existing password for root or do we want to change the password for root so i don't want to change the password for root so let it be no and so when you install mysql there are some anonymous users and also some default you know sample databases gets installed so these prompts are basically asking do we want to remove those you know stuff so in this case we want to remove we we don't really need any anonymous user or you know any of the existing data so i'm just going to select yes and so it is asking do we want to allow root login from remote servers okay so in this case i just want to you know login with root user only from this server so i'm just going to select it no otherwise if you keep it yes then people from other servers will be able to use mysql server and connect to this server using root username okay so i don't want that to happen so here i am selecting no now here you see there are some test databases which mysql may have as part of installation so we want to get rid of that so i'm just going to select no hit enter and in the reload privileges table you can just select yes okay so it says all done and now our mysql is set up now the way to login to mysql is mysql space hyphenu then i'm going to use root user and then space hyphenp okay so after hitting the password correct password i've i've been able to log into mysql so here if i do short databases now i can see you know some system databases which are available there other than that there is no you know junk databases or any other stuff available there so now what we will do is we'll create a database for grafana i will name it grafana db okay the same information i have updated here so we are going to create a database which is going to be called grafana db then i'm going to create a user which is going to be called grafana and the password for that user is going to be grafana okay so that this is the command you use to create a user along with the password and the next statement is basically granting the access on grafana db okay so this is the database which we had created now we are assigning the privileges on grafana db and we are you know assigning this is the user to whom we are assigning the privileges so the username is grafana which we have created and local host is just our server in this case okay so let's run these commands one by one okay so it says query okay it means it has created the database so if you want to verify that whether database is created or not you can run show databases again hit enter now you see grafana db database has been added now i'm going to run this command so it is going to create user and also going to assign a password okay so yeah it doesn't match the you know security compliance and stuff so i'm just going to have one upper case remaining lower case and probably i'll just name it to you know 2020 just make a note of the password which you are setting up so you don't forget it okay then hit enter and you are done so it has created the user and has set up the password now we are going to assign all the privileges on this database to this user the username is grafana okay so this also executed successfully and now flush privileges is just you have to execute after you assign all the privileges okay so yes all the commands executed successfully now we should be able to connect using this user okay so now i'm going to exit from here and then i will use my sql hyper new and we will provide new user which is grafana in this case and also i'm going to provide the password which is going to be the new password which we have set up so now you see i'm able to log in and this time we have logged in with the new user okay this is not the root user which we have used so this ensures that we are able to connect to newly created database now i'm typing show tables command hit enter okay so it says we need to select one database so i'm going to see list of databases so the command to do that is show databases and then i'm going to say use grafana db now it is going to use grafana db so now if i run show tables again so it says there is no tables okay so right now we do not see any tables and basically when we change grafana i and i configuration to use this database that time you will see grafana is going to create lot of system related you know tables or application related tables here so we will verify this again now i'm exiting from here and now we need to make changes in this file which is grafana.ini file so by default the location is under slash etc slash grafana if you are installing using package manager so i'm going to this location and under this location i'm going to change the url okay which is going to be mysql this is just the syntax which you need to follow and grafana is the username here and then we have the password which is in this case not going to be grafana i need to change this password to the new password and then it is going to be at the rate server name and the default port on which it is running which is 3306 mysql db runs on port 3306 by default so we haven't made any changes so we are still going to use this and grafana db is the name of the database so now let's go and edit this file so you can edit this file in any editor you want i just use vi editor and search for word mysql so once you search for mysql you will see there are things like you know you have option of specifying type then host name then name and then username so either you can specify all the database detail here or otherwise you can use the url syntax okay the url syntax i find it much simpler because everything is in one line so by default one second okay i think i lost okay yeah we were here okay so here we need to if it is you know if you see semicolon in the beginning just make sure you remove that semicolon and url change the url to mysql provide colon and then double slashes then it is going to be grafana which is the username and then we need to provide the password which is going to be grafana at the rate 2020 okay i'm just going to keep it in course because i guess it may you know because we also have add the rate as part of syntax so i think it may give some problem so that's why i'm keeping it in quotes now i'm using localhost which is this server and 3306 is default port and then we have grafana dv which is the database which we just created now i'm going to save and exit okay now we can so here if you type history you are going to see list of all the commands which you had just typed so i just wanted to copy paste one of the previous used commands so i just did history and then copied this command now if you see the status grafana was already running before we made any changes okay so previously grafana was using sql lite now we have made changes in grafana.ini file so we must restart it okay so now to restart it you need to use stop and start command so first i'm going to stop it and then i'm going to start this and before that if you want to see the status you can do that so i see the status now is it's not running so now i'm going to start it hit enter okay so seems like it is giving some error let's let's see the error by going into these details so i need to use sudo to use this command so now what i suspect is that the issue is with the you know username and password okay it says something like start request repeat it too quickly so let's try to start again and see what happens okay so we still see the same error okay so what i suspect is that it is because of the password okay so i'm going to change the password of my sql or the other thing possibly we can try doing is let me go back to that grafana.ini file and here we are going to go to my sql and you know here i'm just going to comment this line and then i'm going to provide all the information here okay so type i will change it to my sql and host name is going to remain localhost at 3306 so i'll change it like this and this is the name of the user so which in this case is grafana so that's fine or i believe this is the name of the database okay so and here you need to specify the username grafana username so here what we have done is we have created a new user which is called grafana and then the password which we have is called not password is grafana at the rate 2020 okay so yeah this looks better because it doesn't conflict with this at the rate here let's let's run it okay so this time it has taken longer so i believe it would have started the services okay yes we do see grafana services starting correctly so let's now go to my sql using username which is grafana and password which is going to be the password which you set up and now we are going to use grafana db and then if we do show tables now we can see there are 35 rows in set so means there are 35 tables which has been created by grafana okay so this is very fine this is confirming that now grafana is using you know my sql database okay so that's how basically you can make changes in the database okay and yeah as a side node i will also check how you can use you know url syntax if you if you are password contains at the rate all right so that's it in this section so in this session we are going to talk about making default port changes of grafana on a windows machine if you remember that we have installed grafana we just left the default path which which means grafana is installed in c drive and inside c drive by default it goes into program files and inside grafana labs directory okay so inside grafana labs if you see we have grafana folder and inside that we have conf directory so this is the directory where we have configuration file so on a Linux machine we have something called grafana.ini file so here we do not have grafana.ini file what we have is something which is called defaults.ini file and then we have something which is called sample.ini file okay so you can copy this sample.ini file and paste it again here and rename it to custom now whatever changes you want to make which is non-default changes you should always be making in custom never never edit defaults file so never do that never touch this file just copy the sample file paste it again and rename that with custom and then this is the file where you should be making all the configuration changes now either you can make this configuration changes straight away or you can stop grafana first so now the way to stop grafana on windows machine is you go to services.msc from the run prompt and here you need to search for grafana services so here if you search with capital G you are going to get grafana and it is in the status of running so when it is running if i go to a web browser and if i type localhost now you see grafana is running now i'm going to stop this service so services is stopping now services is completely stopped so i'm going to refresh this and once we refresh we see you know it is not able to connect to grafana the reason being is that we have stopped grafana services right now i'm going to go to this custom file again i'm going to open this file and here we are going to search for 30000 which is the default port and now i'm going to uncomment this line if you see in the beginning we had semicolon okay this is what we had in the beginning i removed semicolon and i'm changing default port from 30000 to 3010 okay save this do not forget to remove the semicolon from the beginning otherwise it is just going to be a commented line so whatever you see beginning with hash or semicolon is just comments so after you done that save it then you can close it and then you can go to so here you will not see this grafana in a in a you know started mode so here you need to now right click and need to start it okay so now you see it is changed to running mode if it is not changed to running mode it means there may be some mistakes which you might have done unknowingly in the custom.ini file and that is causing grafana to not start properly so now i'm going to go back to this url and we are going to change this port from 300 to 3010 if you see if i try on 300 it is still going to continue giving us error by saying it is not able to find anything which is running on this url the reason being is because we have changed the port to 3010 so once i change the port hit enter now you see grafana is running okay so that is how you make a change on windows server in custom.ini file now if you are if you want to make a database related change so you open custom.ini file again and you search for minusql and this is a place where you can change the database okay so the changes for database are going to be the same you know it is going to be the same way which we follow in on a linux machine so you can watch that and then you can follow the same and using that way you'll be able to change the database just make sure database is installed and running on this server or if it is running on a remote server then you you make sure you provide the proper host name and port here okay so that's it so in the so in this session we are going to discuss about how we can upgrade grafana from version six to version seven okay so grafana version seven has been recently released and since we already have learned how we can install grafana six and manage the services of grafana six now it is a good time that we learn about how we can upgrade from grafana six to grafana seven so just a quick recap if we go on to installing grafana on linux you would have noticed that we had actually used these commands in order to install grafana okay now here you see the rpm which we had used was version 6.7 so now next thing which we need to do is we need to use rpm seven version okay so we are we are going to download this seven version of rpm and then once we go ahead with the installing rpm version seven it is basically going to take care of the upgrade process as well now before we do that just make sure whatever the important thing you have already backed up okay so when when i say important things first thing is you make sure you have taken a backup of the database okay and then second thing make sure you have taken backup of the configuration files okay so if you are using sql light then the default directory under which database will be slash where slash lib slash grafana okay inside that you can see grafana dot db so you can take a backup of this and keep it on some backup directory and if you are using mysql then you can use this command in order to take a backup of mysql so if you know in our case we have already changed our database from sql light to mysql so we are going to take backup of mysql so command is very simple you need to use mysql dump command and then space hyphen u after the hyphen you need to provide the username so in our case username is grafana and then space hyphen h hyphen h is the host name basically so here since i have installed it on the same server i'm going to use localhost after that you need to give space hyphen p and after hyphen p you need to provide the password and please note there is no space between hyphen p and the actual password okay and after the password you need to give space and then the name of the database so in our case name of the database is grafana db now this is this command is actually going to produce some output that output we are going to redirect to slash home slash grafana admin slash grafana dot sql file okay that's why we are using a redirection symbol here so let's copy paste entire thing and then we are going to move to the server now here i just want to show you if we do pwd right now we are into slash home slash grafana admin directory and if i do ls you can see here that we previously had downloaded and installed version 6.7.3 okay so now let me copy paste whatever is the command to take my sql backup and then let's hit enter and the command is very quick because we don't have a lot of data and that's the reason it's very quick however in your case if you are using grafana 6 for let's say one year you may have a lot of data application related data available in your database and it can take some time in order to take the backup now here if i do ls again you can see now i have a new file which is called grafana dot sql so this is the file which is containing the backup okay so basically when you take my sql backup what it does it it copies whatever is there in the database into a kind of flat file and then when you restore it you are going to again run all of these commands which are inside this onto your mysql database so if i just do head minus 10 and grafana dot sql you can see this is what we have okay so these are like all the mysql statements which is stored inside this file and whenever you want to restore you are going to execute this sql and going it is going to load everything back to your database however hopefully everything goes well and we will not need any scenario to roll back okay but if you are doing it in a real production environment always make sure you have a workable backup taken so in this case now we can go ahead and start our upgrading process so i'm going to run this duplicate command so what it has now done is it has copied grafana 7 rpm here so it has okay so now you can see we have grafana 7 rpm now i'm going to run the command which is going to be installing or basically upgrading grafana now here if you had noticed you can see here that this package has already detected that this grafana 7 is an update of grafana 6.7 which you already have in our system okay so that's how you know that this is actually performing an upgrade of the existing version now in this case it is asking for the confirmation i'm going to hit y for yes and then going ahead okay so now it says grafana upgrade basically has completed and now we can go ahead and see what is the status of the services so if you remember again from our installation of version 6 we have some commands which we can use to check the status okay so in order to check the status we need to use sudo system ctl space status space grafana hyphen server dot services so if i run this command here i'm going to see the status of grafana so in this case you can see grafana when it upgraded it also started grafana okay and what it means is now i should be able to access grafana okay so other thing to notice here is if you do cat on grafana dot ini file and if you grab it using port you are going to get what is the current port so in this case you can see we had changed the port from 3000 which is the default one to 3010 now i'm going to open a new tab and then we are going to enter the url of new grafana okay so as you remember we are running this on port 3010 that's why i have given here 3010 okay now here please provide the username and the password so in this case i need to provide the username and the password and after that we are able to log in successfully to grafana version 7 now here if you navigate to the bottom left side you can see in the here if we are it is showing as grafana v7 it means we have successfully upgraded from grafana version 6 to grafana version 7 user interface often going to discuss about user interface of grafana so when you log into grafana for the first time you see a very beautiful home page so that home page is basically built of smaller components which are called panels so you join lots of panels and you form a dashboard okay so for example you see here welcome to grafana and here you see some text and some links so this is nothing but a panel as you can see once i move my cursor here on the top of this panel we have something some arrow and which is giving us option to view edit remove and perform some other actions okay so this is one panel and then this is different panel so if i select here i get the same option again okay so each of the panels can be separately controlled and you have an option to edit those panels you have an option to duplicate the panels and again for each of the panels you can choose different type of visualization so that's how you are going to create a beautiful looking dashboard now here again if you see we have list of dashboards shown here this is again one panel and then this is on the right side you see latest from the blog this is again one of the panels okay so a list of panels is going to be used to create a dashboard okay so we'll discuss about panels when we are going to create our first dashboard now coming here on the right side you see option of dashboard settings so if you click on these settings you will be getting some of the options of describing variables or auto refresh and things like that again more on these things we'll be discussing later on so for now i just want to give you introduction about the user interface okay now next to dashboard settings we have something called cycle view mode okay so right now if you see by default we are on the on the left side you see we are getting a panel okay this is the panel which we can use to do loss of configuration and admin related things and also we can use this option to design our dashboards and panels but let's say you don't want to show this panel you want to hide this panel in that case you can click here on the cycle view mode and if i click here one time you will see that now we do not have this panel on the left side okay now if i click on this cycle view mode again you can see now on the top we had home so whatever we had on the top that has also gone so now whatever we see on this screen is only the dashboard okay so this is a grafana dashboard which is built and that is the only option which we see on the screen so when you are creating your own dashboard for example i already have a custom dashboard created here so now let's say this is a dashboard which i want to monitor and i don't really want to see all this stuff on the left side and on the top so i can click here on the cycle view mode and then i can click again and now you see the only thing which i see is the dashboard and i can focus on monitoring this dashboard we don't need to worry about any other things moving here or there okay now let's go back to this screen now let's say if you want if if you don't also want to see this address bar and things like that you just want to see it in a full screen so since grafana is running on your browser and all the browser if you press f 11 then it is going to be you know changing to full mode so in this case if i press f 11 on my screen now you can see i only see grafana dashboard i don't see anything related to browser okay so that's how you can in fact change it to full screen or a complete view of grafana dashboard now to get rid of this or to close this you can either press escape that's going to get rid of cycle mode okay and then if you just click on the top you will get an option to you see this cross option so you can click here in order to get rid of this full screen mode or you can press f 11 again and that is going to return or return to normal view and going to show you the address bar and the title bar of the browser okay so that's how you play around with the screen of the dashboard okay now let's discuss about the options available on the left side so here on the left side on the top first item which we see is grafana logo so this is the home screen okay so if you notice as soon as i move or i hover the cursor on this icon if you just notice at the bottom on the left side you see the complete ip address of grafana user interface along with the port so basically if you click here it is going to take you to the home page okay so if i click here it is taking me to the home page so this is the default home page that's why it is just taking us here on the screen now if you just scroll down a little you will see an option of search so if you click here you can search your dashboard so right now i just have a custom a sample dashboard created but let's say when you have hundreds of dashboards and you just want to search any of the dashboards by the keyword so you can provide that keyword and then it is going to show you the list of matching keywords okay list of dashboards with the matching keywords now if you go back to left side again and click on plus so this is the place where we create dashboards and we also create folders so let me just click on this plus and go to dashboards and then it will be easier for you to understand okay so when you click on dashboard this is the first thing you see okay now here we have option of adding new panels so in this one you don't need to focus how we create panels but i just want to demonstrate you how you can actually add panels so from here you can click on add new panels and then it is going to move you to this edit panel option so from here you can select the visualizations which you want you can connect to different data sources which are available here and then you design your panels now in this case i'm just going to go back and let's say this is one panel and which is titled we can change the title let's say let's call it panel one and let's click on apply and this is our panel one now let's say you want to add more panels so you can notice on the top you have an option of add panel okay so this is the option using which you can create more panels so if i click on here it is going to open one more add new panel box and here now i can add another panel so i'm just going to call it panel two and let's just click on apply okay so by default you saw panel one move down and panel two is here now let's say if i want to move panel one again on the top so i can if i move my cursor onto the title of panel i have an option to drag it and move it either to the right side or move it to the bottom now all the panels do not have to be of the same size so if you want you can make one panel smaller so if you click here at the at the corner of the panel you will get an option to resize the panel okay so i can have multiple smaller panels and i can have one bigger panel so if i want i can make it larger and then we can have multiple smaller panels okay so right now you don't see any data because we are not connecting to any of the data sources but this is how you organize your all the panels in order to create a dashboard okay now by default this dashboard doesn't have a name so you need to click on save dashboard and then it is going to ask you to save this dashboard with a name okay so if you don't give a name it is just going to be called new dashboard or new dashboard copy so i'm just going to remove this and going to call it demo dashboard now you notice when you are saving dashboard you have an option of selecting a folder okay so you organize all the dashboards into folders so by default you will see only general folder you will not see infrastructure monitoring folder this is the one which i have created so by default you are only going to see general and whatever folders you see you are just you can select that and you can save then this dashboard is going to get saved inside that folder so in this case i'm going to click on save and then this demo dashboard is going to be saved inside that folder now let's say i don't want to save it inside general folder i want to save it inside different folder in that case you can click on plus again and then you see the option of folder so if you click on folder here you have the option of creating folders okay so here i had created infrastructure monitoring now you can create any folder and then when you are saving the dashboard you can save that dashboard and select this folder name or let's say if you have your dashboard already created in that case also you can later on change the folder of the dashboard okay so those are the things which we manage from this plus icon if you just scroll down again you get an option of basically home okay if you if you notice this symbol and the symbol here looks the same so this is basically your home page or home dashboard and here also you have options of managing playlist and snapshot so we'll discuss about these later on okay and now if you scroll down you are going to see option of explore okay this is the option where you can connect to different data sources you can see what is the data you what is the data available okay and then you can decide on what is the kind of visualization which you want to see and do all those stuff so basically you can explore your data now if you scroll down or if you move to the next option is called alerting so this is the option where you define all the alert rules for example let's say you are monitoring server utilization under the server utilization you are monitoring different components such as CPU utilization or memory utilization or file system utilization now let's say once you have any of these utilization reaching to more than 80 percent you want some sort of alerts to be sent so those kind of option you set under these alertings okay and again whenever you are creating a visualization or when you whenever you are creating a dashboard during that time also you have an option of setting alerts so we are going to learn that so that's about alerting now let's move to next option which is called configuration okay as you can see this looks like settings so most of the settings or configurations which you are going to do that is going to be done from here so let's say in your case you want to connect to different data sources you want to create grafana dashboard by connecting to mysql or by connecting to influx db or graphite okay or any other data sources so in that case you are going to go to configuration and then you are going to configure the different data sources so just if i click on data sources it is going to take me on this configuration page and here if i click on add data source you will see we have lots of different data sources which we can connect grafana and create beautiful visualizations now if you go back to configuration again you see we have option of creating users we have option of creating teams then we have options of using plugins okay so whatever you see here in the data sources these are nothing but plugins so in grafana you can have your own custom plugin or there are many plugins which are created by communities you can use those plugins and you can make use of that in order to you know have some custom features which are not out of the box feature of grafana and other than that we have preferences so if you go to configuration if you go to preferences here you have an option of you know changing the default theme of the grafana or you can also change the what is the default home dashboard which you want to see so let's say if you want to see some other dashboard on the home screen you can change that and let's say if the user interface you don't want this dark theme by the way this is the most popular theme of grafana in that case you can change it from dark to light and once you do that and once you click on save this theme is going to be changed from dark mode to light mode so these are some of the things which you can change from here now i'm just going to move back to dark theme that's what i like okay so that's all about configuration now if you just move to the next option this is the one which is related to admin stuff okay so this is what most of the admins are going to use they are going to create users they are going to be creating organizations but organizations are not more popular so grafana is also deciding on to get rid of this organization option so other than that we have option of settings so if we click on settings we end up moving to a page which is showing us lots of different settings okay so these are the settings which are coming from grafana dot ini configuration file okay so if you remember we had modified grafana dot ini file and we had changed the port so all of the things which are available in grafana dot ini you can see those settings here so if i search 3010 you can see we have one entry which is called http port 3010 this is the entry which we had changed in grafana dot ini and now from here as an administrator i have the ability to be able to see all these settings okay so from an admin point of view this is very good option and again if you want to make any changes you can make the changes in grafana dot ini and then you have to restart grafana okay and also if you don't want to make changes in the actual file which is grafana dot ini in that case you can create custom dot ini file and you can make changes in custom dot ini file okay we have seen this option when we made changes on our windows machine so other than that we have options related to stats and then we have some options related to upgrade so in the stats we have like what is the volume of users who try to access this and what are the accounts of active users or active admins so these are the things which is going to be useful from an admin point of view okay so that's all about you know user interface of grafana so if you see this is very simple interface there's not too many options okay that's what makes it very simple however it doesn't mean that this is not powerful if we are going to see more of the features or more of the dashboards or panel level properties when we create panels or dashboards but this has whatever you need in order to create an enterprise level beautiful dashboard if you just scroll down here you can see the option related to your user account so i'm logged in i'm an admin user okay this is the default user that's why you see admin here so whatever user you will be you'll be seeing that name here and then you'll be having an option to sign out you'll have an option to change password and you will have option to select the preference of your own interface okay so whatever preferences you change from here this is just the preference for your account so if you change here you i think from default to light mode this is going to be changed only for you this is not going to be changed globally okay and other than this we have here little help icon this is the icon using which we can directly go to communities or we can go to documentations okay and we can explore more about grafana so hope this video gave you good overview of grafana user interface and now we are good to start and we are going to create a couple of sample dashboards and also we'll be learning how we can organize them how we can save them how we can make different changes in the dashboards. In our first dashboard session we will discuss about creating our first dashboard so first thing before we start creating our dashboard is that grafana is only a visualization tool by default it doesn't have any mechanism to store the data okay so if you want to create a dashboard you need to have some kind of data sources it can be mysql database or it can be influx database it can be graphite or it can be any other supported data sources okay because what grafana is going to do is it is just going to connect to your data source and then it is going to create beautiful visualizations it is going to give you the ability to create beautiful graphs you know beautiful visualizations and things however grafana itself doesn't store any of the data which you have okay so if you if i click here on the plus on the left side and i can go to dashboard now here i have an option to adding new panel and let's click on add new panel and then here if you notice under the query window we have something called default okay and here we have lots of other data sources available okay so first thing we need to do is we should be creating our data source so we should be able to see that created data source here and then we'll be able to select that data source and then create our dashboard on top of that data source okay so right now i'm just going to go back again and then i'm going to click on configuration and from the configuration we have option of selecting data source that's one way of going to data source option the other way is you can go to home option and in this case i'm just going to discard it so you click on home option and then there you have something called add your first data source so if you click on here basically this is just going to take you to the add new data source option okay so that's one way and the way i prefer is going to configuration and then going to data sources and after that go and click on add data source okay now in our example we are going to connect to my sql database so i need to select my sql database but you can connect to lots of other available data sources okay we will see connecting to some of different data sources as well in this case we can just go ahead with my sql and now select or click on select option here and then you will be going to the settings option of that data source in this case now i have been moved to my sql connection data source now here i need to provide host name and database username and the password of the database to which i want to connect to now in your case i believe you should be having a database and also you should be having the tables to which you want to connect to in my case let me show you what i have done so as you remember for grafana we used my sql database so in that my sql database i just created one more table which is called matrix and in that matrix table i'm just sending some dummy data that data is basically kind of cpu utilization data and that data we are going to use for creating the visualization so let me connect to my sql and show you how that data looks like okay so now to connect to my sql you can use my sql command and then space hyphen you you need to provide the username here in this case the username which i have is grafana and then you need to type hyphen p and then you can provide the name of the database so in this case our database is grafana db hit enter and then it is going to ask for password so give the password which you have and then you are going to be connected to my sql and by default it is using grafana database because that's the database we passed when we connected to this my sql client now here i can do something like select or let's do show star actually the syntax is show tables so we can once we do show tables you can see here this is the table which is called matrix this is the one which i have created so other than this table all the other tables are grafana application related tables okay so i'm not installing my sql again i'm just going to use the same my sql which is used by grafana application as well and inside that i have just created one table which is called matrix and if we want to see the data of this a table is so we can do select star from matrix and let's say we just want to see 10 records so i'm going to use limit 10 hit enter and then you can see that's the data we have okay so we have dt which is date time we have cpu which is like cpu utilization then we have iowate which is iowate and then we have ideal time of this system okay again this is just the dummy data which i'm inserting to this database every second using one script okay so here you can see on the other side i already have this script running which is actually inserting one record every one second along with some random numbers okay so this is something which you don't need to do if you already have data you can just connect to that data in my case i had to create this table and then i'm going to connect to this table so the things to remember is now we will be needing a connection information to connect to this database and then connect to this table which is called matrix okay so now let's go back to grafana again so here in the settings i need to give the hostname on which mysql is installed so in this case we have mysql installed on the same machine where grafana is installed so in that case i can give local host and the port on which mysql running is 3306 okay in your case if you have mysql installed on a remote server okay which is different than the server on which grafana is installed in that case you need to change here you need to change local host and you need to provide the actual hostname or the ip address of the server where mysql is installed then here you need to provide the name of the database to which you want to connect to in this case database is called grafana db so i have given that and the username is type the username and password in this case i have given the username and password and then that's all you need then you can click on save and test and if it works and if grafana is able to connect to mysql then it is going to show a success message otherwise it is just going to show failure message or the errors which is it is getting so i'm just going to now click on save and test and let's see what happens okay now here you see data source updated and database connection is okay so i see all the green signals which means everything is completely okay and we are able to connect to this data source now if you see here on the top this is the default name of this data source which is called mysql now let's say i want to change it and i want to give some meaningful name so i can give it name of matrix or let's call it matrix data source so for data source i'm going to type ds and matrix in the beginning so whatever naming convention which your organization follows you can follow those naming convention and then you click on save and test again because we have changed the name so we must be clicking on save and test so once you do that again it is going to say data source updated also you are going to see the connection okay message again and that's the indication that now it is working now let's say if you want to make this data source as the default data source whenever you create a panel in that case you can click this default to basically you can turn it on and then matrix ds is going to be the default data source whenever you have any new panel created so let me turn it off and click on save and test and then let's see what happens when we go to plus icon on the left side and go to dashboard so i'm going to press control key while i'm selecting dashboard so it opens on a new tab now it is opening in a new tab okay now here i'm going to select select add new panel now if you see when we do add new panel here we see some other data source we don't see our data source as the default one so if i click on this drop down and then i can see the new data source which we have created which is called matrix underscore ds now i want to keep matrix underscore ds as the default data source so in that case we should be able to change it to or turn it on and then click on save and test again and then you can just close this i'm just going to close this panel and this is something custom which i have already made i'm going to show you exactly how we can make like this now let's go to plus and click on dashboard and now here we should be able to see option to create a new panel once we click click on add new panel okay now here in the default as of now i still see i still do not see matrix ds okay so i have to see what what's going on here so now we can click on plus and now we can go on to create a new dashboard so i'm going to click on plus then i'm going to click on dashboard while i'm holding the control key so what it will do is it is going to open this in a new tab or otherwise you can also right click and then you can click on open link in new tab so once you do that now you should be able to see an option to create a new panel so click on add new panel and in the add new panel you should have an option of query and under the query you should be able to see some data sources and if you click on the drop down you should be able to see the data source which you have created in this case we have created matrix underscore ds so i'm going to select this and then this is the option which i get okay so by default from the matrix data source it has selected one table name which is called alert okay so whatever you see after from is your table name so we don't want alert table the table which we have is you already know that is called matrix so if you click on alert okay just left click on alert and here you will have an option to type matrix okay once you start typing couple of the letters of your table then the table is going to be shown here and you can select the table so in this case i'm going to select matrix that's the table which we have and the second thing which we need to do is we need to select a column which is having a date time okay so one thing which you need to remember about grafana is grafana basically deals with a time series kind of data sources okay which is also called telemetry data sources so basically all your data source must have a column which is having a date and time okay so in my case i already have a table which is having a column which is which is having date time basically okay so that column name is called dt so in that case if i click here by default it is showing a column name which is called cpu okay so here you can see we we also have a column name cpu but this is not the one which is having date time date time is in the dt column so in that case i need to click on this column okay as you see once i move my mouse cursor there on the cpu it changes to a hand symbol okay so once you click here you will be getting an option to select other columns okay so these are the other columns of my matrix table so in this case i'm going to select dt dt is the column which is having date time okay so until now if you see we do not have any option or we don't really see anything here but we will figure that out soon okay so now we have selected a table name in the from clause and also in the time column we have selected a column which is basically having a date time and then this is the statement select statement where you select all the columns or all the visualization which you want to see okay in this case i want to see maximum cpu utilization so we have selected or rather this was the default option which was coming but if you want to change this column to any other column you can click on here on the cpu and then you are going to see all the other available columns okay so you know our data source has other columns like iowate and idle other than cpu so we see all these columns here once we click on the default column option so here i'm going to keep selecting cpu and then here on the if you click here on the plus you will have options of using aggregate functions you will have an option of using alias and you will have an option of selecting more columns so in this case first i will click on aggregate functions because i want maximum cpu utilization okay so in that case i'm going to select aggregate function and then i'm going to select maximum and once you click on aggregate maximum you are going to get an alias as well so this alias by default is the same column name i'm going to click on this and then going to change it to max underscore cpu okay hit enter and that's all you need to do here now let's say if you want to add one more column okay in that case you can click again on this plus symbol and then you can click on column and then it is going to create a new row under this select section and here you see we have the column name cpu shown by default let's say we want to change it to idle so we can change it to idle and let's say we want to see the minimum of idle time so we can change the aggregate function to minimum and in the alias name we can change it to min underscore idle hit enter and now you have two columns okay and on which you have performing some aggregations by the way right now we are working on query editing mode this is very useful which i really like to work with this mode however if you already have your custom query made you can use that custom query directly so we'll learn about that as well now the reason as of now you have not seen the data is that is because of this wear filter okay so i'm just going to click here on the macro and once you click on the macro you should be able to see an option of remove so i'm just going to click on remove and then once we do that once we no longer have any filter we can see our data okay so by default you see in the group by we have interval which is actually anything which is starting with a dollar symbol that is a variable okay so here dollar interval means is whatever interval you are going to select from here okay here you see you have refreshed dashboard and then you have these these are the default intervals so whatever interval you select here that's the interval which is going to be reflected there okay again if you want to remove this you can remove this otherwise you can just leave it as it is or let's say you want to change this interval to different intervals you have an option to do that as well so in my case i'm just going to leave it as it is because this is just a sample dashboard which we are creating okay now this dashboard as of now does not have a name that it has a default name which is called panel title okay so you can click here on the panel title and then you have some other options but by the way if you just click here on if you just see on the right side you have something called panel properties okay so in in case you don't see this panel properties that is might be because you have already clicked on this close options pane so if you have clicked on close options pane in that case you are just going to see something like this and then you can click on show options and it is going to show you the panel properties now here on the panel properties under the settings we can change the panel title so i'm going to change it and going to call it CPU utilization panel with matrix ds okay that's the data source which we are using and if you want you can provide some description this is completely optional i'm just going to copy and paste the same thing here so if you notice as soon as you provide some description you are also going to see one i symbol here on the panel on the top left side so once i hover over to that section it is going to show me the description whatever description is written here okay so it is a good way when we have even you have like four or five different panels on your dashboard it is a good approach that you define a description name for each of the panels so your user can understand what is the purpose of each of the panels okay in this case let me make it CPU utilization using custom script okay so that's all once i hover over here let me just save it okay so basically take some time to refresh and once you click on here you are going to see the new message has starting to appear okay this one thing about giving panel title and description the other things which you can do is you can change the visualization so by default the default one is graph but let's say if you want some other type of visualizations you can do that as well again remember the query which you are using here is going to be different based on the visualizations which you are choosing for example if you see here on the stat it is going to show you only one option so the query which you need to create for stat is going to be different than the one which we have created here for graph dashboard or graph visualization okay so we'll see about other things later on now if you just scroll down you have something called display so you can play with displays and different options and based on whatever changes you make here the graph is going to get changed so if i enable bars or if i let's say disable lines you can see the lines option has gone you can enable it again you can change the line width let's make it seven and you can see now i have very thick line okay then again in the area field you can select different options and you can see the field has changed and in the field gradient again you can select something different and you will see the gradient has changed so you have an option to make changes on how you want this panel to look like okay those are all available under the visualization display properties so if i enable these points and let's say we change the radius of this point in this case we don't see any any difference but again depend depending on the visualizations which we have selected you are going to see different visualizations when you make changes here okay now we will discuss some different options in our upcoming sessions for now you have understood some of the basic things about creating a panel okay so when you create a panel you need a data source to connect to so first thing you should always create a data source then you can go ahead creating a dashboard and inside the dashboard you need to create a panel okay and when you create the panel you can define the queries here and you can save the panel with the panel title and the panel description and then you can hit on save so once you click on save it is going to ask for a dashboard name so i'm going to call it example 01 CPU let's call it CPU utilization dashboard and we can save it under general okay and click on save and now we have our beautiful dashboard ready that's only having one panel okay now let's say if i want to have a different panel which is almost similar and we just want to change that from max cpu to min cpu minimum cpu so in that case you can come here on to the title and you can click here on the drop-down option and you have an option of duplicate under the more option so you can click on duplicate and everything is going to get duplicated then you can come here and go to edit and this way i can just quickly go to the query and i can change this aggregate from max to min and let's say i don't want this column then you can click here on the column once you do that it is going to give you an option of remove so i just got rid of idle so the only column which i have now is cpu column and we are now seeing the minimum cpu utilization and also i'm going to change alias name to min underscore cpu hit enter you can save it and you can you need to provide some description about what is the kind of change which you are making so i'm going to call it adding minimum cpu utilization panel and click on save that's all it's been saved now you can click here on the go back arrow or you can press escape so i'm just going to click here on the go back and now we have two panels ready again if you want to resize or if you want to rearrange you can do that okay so if you want to let's say you want to make it a bit longer you can do that if you want to show it just parallel to each other you can do it or if you want to show it under each other you can do that as well so that's about creating a dashboard and also being able to visualize that now by default this is going to be refreshed whenever you hit refresh dashboard option from here and let's say you want to want this dashboard to be auto refreshing every 30 seconds in that case you can click here on the drop down which is next to refresh and you can select the interval in this case let's say we want this dashboard to be changing or refreshing automatically every 30 seconds so we can do we can select 30 seconds okay so now every 30 seconds this data will keep on changing and you will always see the latest visualization news so now let's talk about how we can use a custom query in order to create a visualization so i'll go back to again the data source which i have okay so this is the table name which we have which is called matrix so let's say we have a query which is called select dt and then we want max of cpu utilization and the table name is matrix and this is going to be a group by on dt okay so that's a typical sql query which we have and if i hit enter let me also put limit 10 and let's hit enter and this is the kind of result which we get okay so now let's say i want to use the similar query for grafana so i can do that let me copy these statements so i will only copy until dt i will not use limit 10 because in grafana we don't want to limit our results to only 10 records okay only for the seeing on the console or on the command prompt i have put limit 10 okay so let's go to grafana and here again i'm just going to use a short method so either we can just click on the title of one of the panel and go to more and then select duplicate and it is going to duplicate the panel and then we can click on edit on that new panel and now here in the query if you see this is a query a okay this is a query which we created using the query builder now let's say i want to get rid of this i can click on remove query option so once you click on that so the query is gone and you do not have any data in the your visualization or the dashboard or the panel which you have so now i'm going to click on query and then if you see here we have a toggle option okay so this is a toggle text edit mode so if you click on this pencil icon it is going to take you to a window where you have an option to type the query okay so by default whatever it has available i'm just going to remove that and going to paste the query which we have just copied okay now one thing here is if right now if i hit enter or basically i try to save it it's going to give us error okay the error here is as you can see here the error here saying is that there is no column found which is called time or time underscore sec so whenever you are working with grafana you need to have a one column which is having date time and that column should be called time okay or time sec so now we do have a column which is called which is having date time and that column is called dt now i'm going to create an alias for this column name and i'm going to call it time okay so once we do that this error should be gone okay so again it takes some time for this to refresh or otherwise you can click on save edit a panel with custom query so that's what i have given an annotation and this is just some description so when admin is seeing he'll be able to see what is that annotation you have given so more about this later on so for now just give some comment and save it and now here if you see we already have the results based on our custom query now let's say other than max cpu you also wanted minimum cpu okay so we can do that by adding one new column which is called min cpu okay again it's going to take some time before you see it or you can hit on refresh you can see on background it is already trying to refresh and you can see one refresh icon here okay so now this is the data we have we have the data for minimum and max cpu utilization again notice the data which we have is not really very changing in dynamic that's why you see the lines almost like kind of straight line because our min and max cpu utilization is almost similar now here if you come down on the panel you see legends so here you see max cpu and min cpu these are the default name which which has been given to these columns you can change it by using alias again so i'm going to call it max underscore cpu and the next one i'm going to call it min cpu okay so once you do that you'll notice a change here in the legends you can now see that these values has been changed okay max cpu is already changed means cpu is going to get changed or you can click on refresh so it can refresh and take these changes okay so now you can see it has been changed so that's how you use a custom query in order to create a visualization so now since we already have influx db and telegraph setup now we can go ahead and create a new data source so for that i'm going to go to configure and then going to select data sources and under this we need to select add new data source and here we need to select influx db so once we do that first thing i'm going to change the name i'm going to change it to influx db underscore demo and then in the url we need to provide the ip address on which influx db is installed and the default port on which you can access influx db is 8086 so i'm going to type http and 10.128.0.4 this is the ip address on which we have influx db installed and the port on which it is running is 8086 and now in the database so whenever telegraph sends data to influx db it also creates a default database which is called telegraph so here you need to type telegraph and in our case we do not have any username and password setup so we can just leave it blank now we can click on a save and test and if everything is okay it should be able to connect successfully so as you can see in our case it is able to successfully connect however in case you have grafana and influx db installed on a separate machine in that case you need to make sure from grafana to influx db port 8086 is open if there is a no if there is no port connectivity between grafana and influx db in that case it is not going to work for you and you may get some error okay so once this is done now we can go on to click on create dashboard and then we can add a new panel and here in the query by default you see some default data source so i'm going to change it to influx db demo this is the one which we have created and now here you whatever you see this is going to be slightly different than my sql data source okay so in the front you see default so default is this is nothing but just a schema name so i'm going to change it to autogen because whenever telegraph sends the data it sends to autogen a schema name and then in the measurement we are going to select cpu so you see all the cpu disk disk io kernel mem so there are so many matrix which has been by default collected by telegraph and it is sending all this data to influx db so i'm selecting cpu and then in the where clause if you have any condition you can give that in i'm not going to give any condition in the where clause and now let's move on to select clause so this is the clause where you need to provide the column names so here i'm going to click on a field and here i'm going to provide let's give usage user so this is the cpu usage by users and then here we can just keep on selecting mean now you saw as soon as we selected usage user we could already see there is some data which has started to show up now this is one field if you want to add more fields you can add you can click on this plus symbol and then you can scroll down to fields and then on the right side you can select field then it is going to create one new row and here you can select new column names so rather than usage user here you can let's say you can select usage iowate now you will see there are two items available here now by default you see there is no segregation of three servers if you remember we have installed it on three servers okay so let's say if you want to see all these details for each server one by one in that case you can do a group buy so in the group buy you need to select on plus and then here you need to select on tag host tag host is basically the host names different host names so now you can see we have three host names we have a host name which is called itpanther03 then we have another host name which is called itpanther03 then we have another host name which is called itpanther04 so these are the three servers on which we had telegraph installed and now you can see we already started getting the data from all the three servers okay now in this case i don't want to make this graph more complicated so i'm just going to remove this usage iowate so for that you can click on field and then you will get an option of remove so you can select remove it is going to remove that extra column okay so now we see we only have a mean CPU usage okay so mean is basically average okay so this is the average CPU utilization from all the three servers now one thing if you say here is duration is pretty large so we have data from 14 30 to 20 so this that's almost six hours now i'm going to change that from here in the time filter and let's say we want data only from last 15 minutes so we can select last 15 minutes and then you can see now our data has been changed okay now one thing is here you see all the dotted lines okay you don't see a smooth connectivity that's because for some time there might not be data available okay so in that case if you right click here on the panel side and scroll down you will see something called null values so if you select null values to be connected in that case you are going to see a smooth line connecting to each other okay so that's what we want so that's why i have changed null values to connected and now one more thing if you notice which is weird is here you see you have CPU mean which is the name of the function also being shown here now let's say you don't want to see here you just want to see the host name here you don't want to see cpu.mean and things like that so in that case in the alias by you can type dollar and then you need to type tag underscore host and once you do that you will notice here it has been changed only to the host names okay again whatever options which you had available for any other data source the same options are available for influx dv data sources as well so let's say if you want to increase the thickness of the line you can still do that and let's say we want to also enable the points okay so now you can see as soon as i enable the point you can see some pointers here and again if you want to enable gradient you can do that so again whatever the visualization which fits best for you you can do all of those after connecting to influx data store as well and after that once you have done or once you have made the settings which you want you can click on save and then i'm going to call it demo influx dv let's call it cpu utilization dashboard okay now you can click on save and then this is going to be saved so you can see very quickly we have installed influx dv telegraph and also we have started getting all the utilization related data and we have set up our first dashboard on using influx dv so in this session we will see how we can add threshold to any panel so now here you see this is a graph which we had created which is telling us cpu utilization from three different servers so i'm just going to duplicate this panel so for that you click on the title and then you are going to get option of more from there you select on duplicate now it has duplicated the same graph now on this duplicated graph i will click again on the title drop down and then i will select edit so once you go to edit you will see on the right side we have panel properties so here you can scroll down and reach to threshold okay so this threshold we need to select add threshold so as soon as you do that you will see a symbol with a broken heart okay so this is basically grafana's way of telling that we are going to cross threshold okay so here you can define threshold of let's say in this case i'm going to change it to 80 percent so this line is indicating threshold so anything which is crossing that is basically going to be resulted in something not being okay and that's why you see a broken hearted symbol here okay so yeah once you do it on 80 and again on this is a critical color symbol which has already been set so if you want to let's say disable the fill you can disable that in that case you are not going to see the above area being filled with red color however if you just enable it in that case you can see the above area which is more than 80 percent is filled with red color so from visualization perspective this is very good you'll be quickly able to identify that the value which is going beyond a threshold now you can click on apply and save it so now you can see the difference between a panel which is having which is not having a threshold and this is a panel which is having threshold so let me rename it to cpu utilization graph with threshold okay and now we are going to create a couple of more indicator which can give a single value output okay so in that case let's again duplicate this cpu utilization graph then i'm going to move it here on the first quadrant and here we are now going to edit it and now i will be changing the visualization from graph to either you can change it to gauge or you can change it to stat so let's see how it looks like so if i click on stat this is the kind of output which i'm going to get okay and if you click on gauge you have kind of gauge meter and you can decide what is going to be good value what is going to be ember value and what is going to be red value in your case okay so let's select gauge and then we can go on to field and in the field here you can define the threshold okay so let's say i say from base until let's make it 50 so from base until 50 is let's make it yellow and then we are going to add one more threshold which is let's call it above 80 percent so anything which is going to cross 80 percent we are going to mark it as red okay so that's how this is going to look like now when we can change the size of this and also in this case let's say we want to get rid of this title we don't want to have this title name so i'm just going to remove this because visually it's going to look better okay so now you can see we have something like a single indicator which is giving us an indication about what is the health or cp utilization health of each of these servers and here also you can see the trend line now let's duplicate this and we can then select stats and let's see how that looks like okay so i'm going to select stat and that's how it is going to look like in the field also the threshold whatever we had duplicated is available here so if you want to play around and if you want to change the values you can do that in this case this seems to be okay and we can just click on apply and this is another type of panel which we have created okay again it depends what kind of visualization you want to achieve and based on that you can select the required graph in in this session we will learn how we can set up alerts in grafana so alerts are a very useful way of notifying users if there is something goes wrong so you can actually trigger emails if let's say cpu utilization is going very high or let's say free ram utilization is decreasing continuously it means that your system is being occupied and there is very less memory is available in order to process anything else so these are the some of the scenarios on which you may want alerts to be sent now as you can see here i have a dashboard which is talking about ram utilization and then i have a dashboard which is talking about cpu utilization okay and now here if you notice we have a yellow line and then we have a red line okay so how this is happening is this is the point at which it started noticing that yes the ram utilization is now has reached to the critical threshold and now from here on it is going to be continuously checking ram utilization up to the specified time which we have defined while configuring alerts and once it reaches the threshold it is going to create an alert so at this point of time it is going to send an email or any other alerting mechanism which you have configured and then here on the right side we have critical alerts so this is basically alerts dashboard this is grafana alerts visualization this one is going to give you all the alerts consolidated at one place so let's say you have alerts coming from two or three or multiple different panels for example this is one panel which is sending alerts related to ram utilization and then this is another panel which is sending alerts related to cpu utilization and then this is one dashboard okay which is called demo influx dv cpu utilization dashboard similarly you can have hundreds of different dashboards which is sending alerts and if you want to see all of those alerts at a single place in that case you need something called alerts dashboard and this is a dashboard which is basically going to show you all the critical alerts in a single window okay so enough of theory let's now start seeing how we can implement this now in order to implement this first thing which we should be doing is we should be going to alerts and checking about notification channels okay so let me save this dashboard which i have already created and then i will show you how we can create all of these dashboards again now i'm going to alert and then i'm going to notification channels and in the notification channels if you see i have created a notification channel which is i have given a name of ops team which is operations team and the type of alerts is email okay now let's see what are the other types of alerts available here so i'm going to click on new channel and once you click on new channel you are going to be presented with a screen where you need to configure the new channel now here you can give a logical name to your channel for example let's say this is a list of all the admins then in that case you can give admin at whatever your email id is basically or whatever the group distribution list is so in this case let's say i'm going to call it admin at itpanther.com okay and then here in the type you see we have so many different types of alerts which can be configured okay we can configure email if you want you can send alerts on telegram which is very good messaging app you can configure alerts to be sent online and there are so many other options available okay however in this session let's just talk about emails now you see the second option or the third option available here is which is saying default send on all alerts so do we want this alert to be sent or this email to be sent on all the alerts so in that case yes we want email to be sent on all alerts so we can enable this and now you can move down and here in the email settings you can put all the addresses okay so in this case let's call it or let's say i have a distribution list which is called linux at linuxadmin at itpanther.com that's one of the distribution list which is going to send an email alert to all the members which are part of this distribution list okay again these emails i assume in your organization you'll already be having all the distribution list and if you want to send email alerts to multiple distribution list in that case you can put one email distribution list followed by semicolon and then another distribution list so let's call it windows admin at okay and then you can also put individually or individual email ids so let's say i want to put my email id i can do that as well okay and guys notice one thing right now we do not have smtp configuration setup with grafana that's the reason okay whatever we are configuring here is not actually going to send an email because we have not configured grafana with smtp we will see how we can do that but in order to learn that we also need some kind of smtp details so we will see in our upcoming session we will probably going to get one of the free smtp details and then we are going to configure that using grafana however in this case from the alerting perspective when you have grafana setup with smtp that's all you need here and then you can just save it and now you can see you have a logical name which is called admin at itpanther.com if you want to modify it you can click on this name again and then you'll have an option of editing this so in this case let's say i'm just going to remove additional domain name from here the logical name i'm just going to keep it admin and then let's save it okay so now we have alert notification channels configured now we can go ahead and start creating the dashboard okay so let's go to create and click on dashboard and here we are going to create or click on add new panel and the first thing which i'm going to create is related to cpu utilization okay so again in the data source we need to change it to influx db demo this is the one which we have configured and in the from i'm going to change it to autogen and in the measurement we are going to take cpu okay now here in the wear clause i want to filter only on one host so in the wear clause i'm going to click on host and then in the tag value we are going to select only one server okay i don't want all the servers if you want only one server you can use wear clause okay so in this case let's keep itpanther 02 server this is a server for which we will be checking cpu utilization and once cpu utilization reaches beyond a threshold and that case we want an alert to be sent okay in the select uh select field we want let's say we want usage system okay so once cpu usage system is high we want an alerts to be sent and in the aggregate function we don't want average we want max so i'm going to remove this and going to click on plus symbol again and then going to click on selectors and then going to click on max okay so this is going to give us max of cpu utilization at every specified interval so interval here is let's change it to every one minute okay so this is hopefully this is clear until now and let's change the panel title to call it cpu utilization panel okay now if you remember whatever we configured here this query has a name a logical name this is called query a so if you click here on this drop uh this little arrow it is going to expand or collapse this okay so this query is basically have a logical name of a the reason why i'm telling you this that when now we are going to configure alerts and in the alerts we are going to refer this query with its name which is called a okay so now in order to set up alerts you you need to actually do that from the same place where you configure dashboards okay so this is a place where we are actually configuring our panels and dashboard and visualization and things like that now here if you see other than query we have a third tab which is called alert so i'm going to click on alert and then here you see we have an option of creating alert so let's click on create alert okay and now it has picked up a name of whatever the panel name was which is cpu utilization panel and it has given or it has post fixed alert in then but if you don't like this name or you want to change this name you can do that as well so now in the ruling engine what it is saying is that this alert is going to be evaluated every one minute and it is going to be evaluated for five minutes okay and what it is going to do is this is a condition which is specifying what is the threshold condition so let's say in the threshold condition i'm saying whenever max of cpu utilization okay so here you see in the query we have a this a is the one which is which we configured here so in the a we are specifying the maximum cpu utilization so what this means is in the current scenario what it means is when average of cpu utilization for last five minutes going above certain threshold then we want an alerts to be sent however in this case we will make some changes so in the rather than average i'm going to change it to max and here i'm not going to make any changes i'm just going to leave it as it is okay or we can probably change it to let's make make it let's change it two minutes okay so in the threshold i'm going to change it to let's say 40 okay so whenever cpu utilization is going to reach more than 40 percent and it is going to reach or stay continuously more than 40 percent in that case we are going to get alert and that continuation has to be for five minutes okay so whenever it reaches more than 40 percent for the first time in that case it is going to create an alert with a status of pending okay so here you can read that when you click here on this information symbol you can see here so whenever this alert is going to reach a certain threshold for the first first time then that time grafana is going to create an alert and going to keep that in pending status and once that threshold is going to stay in that situation for a certain amount of time which is configured here so in this case it is five minutes so when we have a threshold reaching around or going above that threshold for five minutes in that case that pending status is going to be changed into alerting status and that's the time when grafana is going to trigger all the emails okay or if you have any other channels configured like sending notification to telegrams or line so all those action is going to be triggered then now in this case i will also reduce this to two minutes because we don't want to wait longer okay and now if you scroll down we have notifications so these are the channel names which we had configured so if you remember i had already configured ops team and then we had also configured admin so that's why we see all of these channels here okay now i'm going to save it okay so you can click on save and you can give a dashboard name so let's call it demo alert and i'm going to keep it in general folder if you want to change it to any other folder you can do that so in this case i'm just going to keep it in general folder and click on save and here now you can see our first panel which is showing a cpu utilization but right now cpu utilization has not reached above a threshold that's why we don't see anything as of now okay now before i go on and increase some of the load on this server i will also want to show you one more panel which is which is alert list okay so i'm going to select alert list panel and then we can click on apply so right now you saw as soon as i clicked on alert list we started to get alert but basically we started seeing all the alerts from different dashboards as well so that's basically the functionality of alerts panel it is going to show you all the alerts at one place and if there is no alerts it is just going to be blank let me change this the title to let's call it all alerts and click on apply and now whenever we have any alerts coming from any of the dashboards or any of the panel that's going to be shown here okay so now i'm going to increase load on this server so this is the server which is itpanther02 on this one i'm going to increase or going to start some of the process which consumes more cpu and then we should be able to see certain spike in the cpu utilization okay so now slowly we should start seeing spike in cpu utilization and let me also change the refresh interval to every five second let's make it last 15 minutes okay so now you can see we already started getting i mean the cpu utilization has shoot up and we already started getting one alert and right now it is changed to pending state okay so this is what i was telling you so first time when alerts came it changed it to pending state and also this is kind of annotation which is available so now let's say if you want to when you mouse when you hover your mouse cursor to this arrow it is going to show you what was the cpu utilization at that point of time so this is the starting point of time at this time the alert status is shown as pending so once it continues to be at this threshold or continues to crossing this threshold for two minutes or more in that case it is going to be changed into alerting okay so this is the alerts which is coming from this panel and then we have these alerts which which are coming from different dashboards which i had already configured and while it is calculating or it is waiting for you know continuous threshold for two minutes or more let's click on this annotation and once you click on this annotation you will notice there is a small pen or pencil icon here so you can click on this pencil icon and then you will have an option to provide more description here okay so in this case let's say you want to provide more description about this alert for example i'm going to call it testing of redis load is going on which resulted in high cpu utilization okay so whatever reason which you had you can put those reason here so and save it so next time when someone is going to see that or when someone is going to hover over that alert in that case it is going to show them this remarks okay so from a management point of view or from operation or operational team or from monitoring team point of view they are going to hover over the mouse here and then they'll be able to know the reason now you see after the two minutes in turbo we have got another alert which is in red color and also here the cpu utilization panel alert has changed to alerting okay so this is the time when all the emails should have started triggered and you would have got email in your email box okay now as soon as this alert or whenever cpu utilization goes down it is going to change it to green again so i will show you by killing this process so whatever process i was running which increased the load i have just killed that process and now cpu utilization should start to go down so let's notice that and in the meantime we can also put remarks in this annotation and i'm going to call it that is load test is still going on it is going to finish in a couple of minutes okay so that's it and now when someone is moving their mouse cursor around this annotation they should be able to see all the remarks which we have set up here now you see cpu utilization has already started going down or it has started going less than 40 so after two minutes we should be able to see this changing to green again okay so that's the indication that alert has gone and it's no longer available so typically what you do is you have one alert panel which is like going to be on top of any other graph or you you have alert window which is like the focus point for the monitoring team you have different dashboards configured you can have like hundreds of dashboard configured which is sending alerts and then you have only one alerting dashboard which is which you hand over to monitoring team and they are the one who are just going to focus on alerting tabs so whenever they have alert maybe they need to start communicating to the relevant team in order to you know so they start working and fixing those alerts and one more thing here is if you click on add panel you will see something called convert to row okay so once you do convert to row you will have an option of moving all of whatever the panels available here to a a kind of expendable and collapsible row so i'm going to click on convert to row and now you see we have this something called row title so i'm going to click on settings and going to change the name from row titles to let's call it high level or let's just call it dashboard 01 click on update now you see dashboard 01 here and also you see this arrow so if you click here it is going to collapse everything and if you click here again it is going to expand everything so you can have like many number of panels created here and then you can arrange them in row panels so if somebody wants to focus only on a particular row panel they can go there and click and they'll be able to see more details of that row panel by the way in the meantime as you saw now since the CPU utilization has gone down we also got a new alert which is in green color and it is showing that CPU utilization has become okay now and also the little heart symbol which we had now it has turned to a green heart symbol so that's how you handle alerts in grafana so in this session we will learn how we can set up grafana and telegram alerts so in order to configure telegram you again need to go to alerting and then go to notification channels once you go to notification channel you can add a new channel by clicking new channel now here let's give a name of let's call it grafana telegram test and in the type you need to change it to telegram now if you just see here there is an option to include images if you include images whenever you are breaching certain threshold that image is going to get rendered from grafana and going to be sent on alert as well so if we want to enable this on previous version which is like version six point six and below you could just enable it and then it would have started sending image but in grafana seven image rendering is not by default available so we need to install image rendering plugin so if you when you enable it and you click on this link you are going to be taken to a grafana image rendering plugin so here if you scroll down you have an option of using or installing grafana image rendering using grafana cli plugin so i have copied it and i'm going to install it on our grafana server okay okay we need sudo access in this case because we are not logged in as a root user so either i can switch to root user by doing sudo space su space hyphen or second approach is i'm just going to delete this second approach is you can use sudo in the beginning and then you can copy paste same command again okay so i have put sudo in the beginning and rest of the command is same hit enter and then it should be able to install this plugin okay so it is saying now it has successfully installed however we also need to restart grafana okay whenever we are actually doing any of the plugin installation we need to restart grafana so let me do that as well so there are two approaches either you can use system ctl or you can use the command which is given here so in this case i'm just going to use this command which i have typed hit enter and then it should be able to restart grafana now you can check the status again by changing restart to status hit enter and if grafana is in active status it means everything is okay now you can go back to grafana screen again and refresh okay so we actually came back to whatever we had done so far that is lost because we did not save it anyways we just now begin again we can type the name which is let's call it grafana telegram test and here in the type we need to change it to telegram and now in the include image you see now it has been turned on and we don't get any warning which means now whatever plugin we had installed is successfully working now this is the important things here if you see in telegram api settings we need to provide bot api token and also we need to provide chat id so what are these two things and how we will get it so for that we need to login into telegram so i'm logged into telegram using web interface but you can log into your mobile as well and then you need to search for there's something something called botfather okay so you need to search for botfather and using this botfather you will be able to create your own bot okay so i have already followed these steps i'll show you what we need to do so we need to go to botfather and then as soon as you go to botfather you need to type slash start once you do that botfather is going to give you some list of available options okay here you can see we have got automatic reply from botfather with so many options so now we want to create a new bot so you can click on new bot and once you click on new bot your response is going to be sent something like this slash new bot and then again botfather will reply and it is going to ask you what is the name you want to give to this new bot which you are creating so in this case we are giving it a name of grafana admin and again then botfather is going to ask you what is the username you want to give to this bot so username also we need to post fix underscore bot so in this case i have just used the same name and i have just used underscore bot so our bot username is grafana admin underscore bot and after that you will get congratulations message along with the token okay this token is very important and this is the token which we need to provide in so this is the yeah this is the token which we need to provide when you are configuring or when you are integrating basically telegram with grafana so i am copying it and i'm going to use it here okay and now in the chat id we need to provide the chat id or now let's say if you want to send all the alerts to one of the groups okay in that case you need to create a group first let's say you already have any group created in that case you can add your bot which is having user id of grafana admin underscore bot to that group and then whenever grafana is sending alert to that bot it is going to go in that group okay so i'll show you how we can do that i'm going to create a group and let's add grafana admin underscore bot in this group and let's give this group name let's call it grafana ops telegram group okay so that's the name of the telegram group in your case you may already have any existing telegram group and you just want to enable alerting in that case you must add this new bot which we have created and make that part of that group okay so let's click on create group and now we can see group is created in this group if you see we have two members okay one is grafana admin so this member is very important if you do not have grafana admin underscore bot or basically whatever bot you created that should be part of the group so once you do that now you need chat id right you saw here we need to provide chat id so to provide chat id there is basically something called an api okay this is the url of that api and in the end if you see we have get updates so what it does is whatever your bots token id you need to provide that token id here and then you need to basically use this complete url and just replace this token id with your token id and hit enter and then you are going to get all the response here okay and that response is basically going to contain the chat id so i'll show you how we can do that so once you add a new member to the group okay once you add bot to the existing group you also need to send some dummy message so i'm just going to say hi and let's send this message to this grafana bot basically hit enter okay and now i have already copy pasted this token okay and i have already pasted this token here on this url and after that i'm going to hit enter and now you see whatever group we had created which is called grafana ops underscore telegram underscore group okay this is the message basically this is the group name okay now here you see something beginning with id so this is the id which is chat which is basically chat id which we need to provide so i'm just zooming it a bit and this is the response which we have received from get updates api and this is the chat id which we need to copy and paste here in the chat id now once you do that now you can click on send test in order to see whether it is working properly or not and let's go back to telegram group again which we had created okay so the group name is grafana ops underscore telegram underscore group so right now you see we do not have any alerts from grafana i'm now going to test here by clicking on send test and now you see it is saying test notification is sent we see the green signal let's go to our telegram group again and here you can see we have received an alert okay so now whenever we are setting up any alert on any dashboard we can use this name which is grafana telegram test okay so let's save this this configuration is fine let's save this and then let's create or let's go to one of the existing dashboards so in this case let's go to demo alerts dashboard now if you remember previously we had created a panel which is having alert and whenever basically cp utilization is going to get high this is going to send an alert however previously in the in the alerts we had just added email alerts we hadn't added telegram alerts so in this case i'm just going to click on this title and going to edit this and then we'll go to alerts and then i will add telegram alert as well so if you remember the name for that channel which we had configured that is called grafana telegram test so i have added that and now we can click on apply okay so right now you see cp utilization is down so let's wait for few more seconds and then i'm going to run the run some workload which is going to basically create a spike in the cp utilization okay so now we see everything is normal cp utilization is very less so now i'm going to create some workload which will basically be resulting in high cpu utilization so we should be able to see spike in cp utilization from this time onwards and once for the once it reaches above that threshold first time we are again going to see that yellow line which is kind of indication that value has reached beyond threshold and once the same situation you know continues for two minutes because we have set up two minutes in our alert query i just want to show you again so here in the alerts you can see we had put it two minutes so once the same situation continues for two minutes then in that case it is going to create a new line with the with red something like which has previously been done okay and this is the time when you see the red line this is the time when actually the alerts get triggered so that's the time when we should be able to see a new message arriving in this group telegram group now you can see we have already got one yellow line so this is the indication that alert has reached basically we cpu utilization has reached threshold and the first alert as i told you gets created with a pending status so here you can see the status is showing as pending and once we have this continuing for two minutes then in that case it is going to change from pending to alerting and that's the time when we'll be seeing a new message arriving here so right now if you see we do not have any new message in this group because status is still showing as pending so let's wait until it changes to alerting and then we are going to go back to telegram group and see what is the kind of alerting which we have received all right so now we can see we have a new line appearing in red color and also status has changed to alerting so i'm going to go to grafana group and now you can see we have received a new alert here on our telegram group so in this session we will discuss about plugins and we are going to understand what are the different types of plugins available and what are the different methods of installing plugins okay so now to begin with plugin first thing i'm just going to create click on add panel and then i'm going to go to add new panel and here if you notice on the visualizations we have around around 10 to 12 visualizations available okay and we do not see many other visualization types such as let's say pie chart okay so let's say if you have a requirement to make visualizations using pie chart or any other visualization which you do not see here then you can search those plugins because most of the charts or visualizations are already created by community and it is available on grafana plugins market store so i'm just going to go back and we don't really need to save it so now if you go to configuration you have an option of plugins so here i'm going to click on plugins and this is asking whether we want to save the current dashboard i just want to discard it we don't need to save anything yeah so here you see list of plugins which we already have available okay and now let's say if you want to add a new plugin in that case you can click here which is showing find more plugins on grafana.com so i'm going to click here and once you have internet it is going to take you to this tab okay basically this is the this is the page from where you can see all the grafana plugins okay i'm just going to go back i will open it in a new tab so we have grafana opened in one tab so i'm just going to right click here and going to select open link in new tab okay now here one thing you will notice there are so many plugins there is plugins available almost for all the needs however one important thing to notice here is you will see most of the plugins are marked as open source and there are some of the plugins which are marked as enterprise for example if you see here amazon time stream is marked as enterprise and also if you notice like app dynamics is also marked as enterprise so these are the plugins if you want these plugins then you need to basically have an enterprise version of grafana because these are the ones which are not available for or not available as an open source okay so in this case let's say i just want a pie chart panel so in this case pie chart we can see pie chart doesn't have enterprise written over here so which means it is openly available to use so i'm going to click on pie chart and once you do that you are going to be presented with the screen which is going to be talking about overview of the plugin so in this we do not have much documentation about this plugin but you will see for some of the plugins there is very good documentation available so you can read those before you install any plugins okay so now there is one method of installing grafana plugin by using grafana cli so in this case we can just simply copy this and we can paste this on the grafana server and again we need to be root so i'm going to type sudo in the beginning so once i hit enter this is going to get installed okay so that's one way and this will only work if you have internet connected on the server okay so wherever server you want to install this plugin you must have internet available because what this is going to do is this is going to go to that grafana plugin store and going to download this plugin and then install it for you so the other approach is you can download these plugins using offline method and then you can move this from let's say using venuscp from your local machine to the server and then you can follow the steps mentioned here in order to install the plugin and again whenever we install any plugin we need to restart grafana so here you see command of restarting grafana so in this case it is very simple i'm just going to use this grafana cli method so let's go to server and here you see we already have the command pasted so i'm just going to hit enter and it should proceed with the installation so you saw the plugin was very small so it has very quickly installed this plugin now we need to restart grafana so this is a command which i'm going to use in order to restart a grafana again we need to run it as a root user so i didn't run it as a root user that's why it was asking for password now i put sudo in the beginning and now we should be able to restart this now if you want to see the status we need to replace restart with status and now we can see grafana is already active so in this case we should be able to now able to see new plugin available here so right now we see that new plugin is not showing here that is because we have not refreshed this web page so i'm going to refresh and now you can see this pie chart is available okay now also we can go back to our dashboard and there we can create a new panel and we can start using this new visualization so i'm going to click on add panel then under here in the visualization we can see now pie chart is available okay so let's create a quick visualization using pie chart so in this case again i'm going to use our influx db data data store and i want to see cpu utilization and let's say we want to see usage system okay so right now you see we have only one item that's because we have not grouped by on any of the items so if we group by based on cpu or based on host then we will see the data changing here so i have grouped by based on cpu so in my machine i have two cpu cores so cpu 0 and cpu 1 these are the two cores which we have available and here it is showing the average utilization of each of the cpu cores now if you want max utilization you can change here from mean to max so i'm just going to remove it and i'm going to select in the select selectors i'm going to select max again as you remember if you want to change here if you just want to see the cpu number rather than seeing this complete function so you can again use tag underscore cpu and it should be able to show you now only the cpus guys one thing you should be aware of whenever you install any plugin just make sure you read about that plugin carefully and that whatever plugin you are going to install especially if you're installing on a production system just make sure that is you know authenticated plugin and it is going to work in your environment if possible test it in your test environment before installing it directly in a production environment in this session we will learn how we can create users in grafana and also we'll be discussing about what are the various roles you can provide to users and based on that roles what are the things or operations they'll be able to perform in grafana so first thing is if you want to create a user you must have admin role if you do not have an admin role you will not be able to create users in grafana so i'm logged in with my default admin user and then i'm going to go to server admin and here you can see the option of users so click on users and then here you can see a button which is called new user so i'm going to click on new user and here you need to provide details of user so let's call it smith and email i'm going to give smith at itpenter.com and username also i'm going to keep smith password also you can provide whatever password you want so in this case i'm just going to keep smith and then you can click on create user as soon as you click on create user you should be able to see that user is created successfully now in order to see what is the role which has been provided to this user you need to click on this user so by default whenever a user is created it has a role of viewer so you can see right now this user is having a role of viewer now you can click on change role and you can see what are the other roles available so you can see there is a role of editor and admin so we don't want to make all the users admin okay so it is always a good idea you make most of the users just as a viewer because if everyone is having ability to make changes in grafana that is not going to be a good thing from management point of view and you can give viewer role to someone who just needs to look at the dashboard and needs to monitor them typically it is going to be the role which you give to l0 in your organization and they are the one who's who are responsible for monitoring different type of dashboards and they are the one who are going to manage all the alerts now in this case i'm just going to leave it as it is so let's leave it viewer and now here if you see we also have ability to update any of the information so let's say once you created the user and later on you wanted to change the name so you have the ability to change the name of that user or email id or basically you can change all the user information here and also here in the sessions you can see from which all devices the user has logged in so right now this is a new user so that's why we don't see anything in the sessions now i'm going to open a new browser and here we are going to log in with the newly created user so once we log in we will see what is the difference between an admin user and a view only user so first thing when you notice you know as soon as you log in as a viewer is that on the left side you had very limited set of options available if i go back to my admin user so here you see you have options such as explore alerting configuration and server admin these are the options which are not available to a user with viewer role the only option available here is dashboard so he can go to manage and then this user can see all the different types of dashboards available so demo alerts is the one which we had created previously so user with view only right can see all the dashboards and if he wants to modify any of the panel and user clicks on title he will not be having an option of edit okay so that's the view only rights now let's change this user permission to editor and let's see what is the difference which happens so now i'm going to change the role to editor and now i'm going to save this so once we save this screen also got refreshed and that's the reason now you can see in the session we have new entries available so this is the ip address from which this user logged in and this is the browser from which the user was logged in and also you get the information of operating system now let's say in case you want the user to log out okay so as an admin you have the ability to force log out the user so if you see here right now i'm still logged in so i'm going to click on force log out and going to click on confirm log up so now this user is going to be logged out from here so you see automatically this user got logged out since now we have also updated the rights to editor so now we will log in again and we will see what is the difference in the user interface now so as the name suggests as an editor there will be some extra options available which you can now see on the left side so we have an option of explore and then there is an option of alerting and also now if we go to manage dashboards and let's say we select one of the dashboards which is demo alerts and now if we click on any of the panel we if we click on the title we now going to have an option of edit so a user with an editorial right will be having ability to edit any dashboard change thresholds or perform any kind of visualization action this is the kind of role which you can give to a developer or basically grafana visualization developer in your organization now again if i go back to admin console and i refresh the screen you'll be able to see i'm going to see the information of this user and whatever machine the user is logged in from so now if the user is logged into multiple devices you'll be able to see all those sessions here and if you want the user to be logged out from all the devices then you can have you have ability to click on force logout from all devices so this is going to make sure that user is logged out from all the devices so that's the basic difference between different types of users and roles available in grafana so based on the kind of roles and responsibility performed by a particular user in your organization you can provide the rights accordingly in this session we will learn about tabular visualization type in grafana so i'm going to click on add panel and i'll be selecting table in the visualization now here in the query i'm going to change it to influx db demo data source and in the form i'm going to choose autogen and in the measurement i'm going to use disk let's say we want to see disk utilization for all the mount points so in that case again in the field value we need to change it to used percentage because i want to see the percent of utilization for each of the mount points now in the group by we need to select path okay so path will give us each of the mount points so now you see as soon as we selected path we can see a drop down being added here with the option of selecting a path now let's say you don't want disk dot mean to be shown here you just want the path so in that case you can use alias by field and here you can use dollar tag underscore path and what this will do is now you can see here in the drop down it has been changed to only the available mount points now let's say if you had a requirement like this in that case no this fits okay for you then you can leave this drop down as it is that's number one okay and in this case i'm also going to change the interval so i'm going to change the interval to let's say every five minutes okay now however in my case let's say i don't want data to be like this i want both or all the available options here to be shown as a new column okay so with that what i mean is i want a column which is having total disk percentage available for slash mount point and then the other column which is having total disk utilization percentage available for slash boot slash EFL so now to do that you need to click on transform and then scroll down and here in the ad field from calculation you need to click on select so once you do that you will notice whatever options available under this drop down it is going to be changed into columns so that's what i want so i'm going to click on select here now you can see we have both the mount points so slash is the mount point and then slash boot slash EFL is another mount point so i can see the utilization for slash mount point around 1205 was 66 percentage and utilization for boot EFL was 5.5 percentage and in total it rounds up to 72 percent utilization now let's see on the right side you will see an option of field which is next to panel so once you click on field you have an option of doing the column alignments now whatever alignment you do here it is going to be reflected on the table level so with that what i mean is let's say i want to change the alignment to center so once i click on center you will notice all the value or all the columns has been center aligned and if i click on right all the fields are going to be right aligned in this case now let's switch it back to center and now here in the cell display mode you see we have something like color text color background gradient gauge lcd gauge and json view now let's say you select color text in that case you see whatever color or whatever you selected basically going to be applied to all the values now let's say you don't want to have this behavior you want to format each column one by one okay so we will see how we do that before that i just want to show you this gradient gauge so if we click on gradient gauge now you can see our values for all the fields are showing in a kind of gradient gauge visualization which we had okay now however let's say we don't want this to be for all the columns we want gradient gauge only for total column so i will show you how we can do that in this case again i'm going to change it to auto and also i don't want center alignment so i'm just going to change it to auto and now we need to go to overrides okay so overrides is the option where you'll be able to change these things so i'm going to click on add override so here you will notice we have an option of filter by field so i'm going to select filter by field and here i'm going to select the field so in this case let's say i want to select field of total and now we will click on add override property and here in the cell display mode i'm going to select gradient gauge okay and now let's also click on add override property again and let's add threshold okay so let's say when we have anything going over 70 we want that to be shown into red so i'm going to change this value to 70 okay so now you can see how data has changed here and how the colors and all has changed here so this is about this total column now let's say we want to center align this slash boot slash efl column so in this case you can add another override and you can again click on filter by field and here you can select slash boot slash efl now here you'll be having option of column alignment so in the column alignment you can select center and you will notice that only this column has been affected and now we can save it and now you have table visualization ready so in this session we are going to discuss about using stat visualization and we are going to have bit of deep dive into formatting and some of the different options available with stat visualization so as you can see here i have already created a stat visualization and this is what data looks like so this is giving me total disk utilization for all the three servers and for all the available mount points so you can see i have server which is called itpenter02 itpenter03 and itpenter04 and also on each of the server i have two mount points so that's why total i get six blocks and also you see we are getting percentage and below that we are getting kind of sparkline so now let's see how we can create this visualization so i'm going to click on add panel and i'm going to add stat visualization okay now here in the data source i'm going to select influx dv demo and i'm going to change it to disk and also i'm going to here select total used percentage okay so right now you seeing we are getting a single value that's because we have not added group by so in the group by now i'm going to add host and also we want each of the mount points so i'm also going to add path so now you can see we have total six values and if you notice here in the name we are getting functions okay so we want to get rid of it so i'm going to add tag underscore host and also going to add tag underscore path now data has or you can see the title has improved a bit now here panel title i don't want any title so i'm just going to remove this so if you remove this there will not be any visible title and just below that there is an option of transparent so if you enable transparency you can see you will not have any kind of border line or grid which was shown when you disable this so in some of the scenario it looks more visually appealing when you have this turned on so in this case i think it's going to look better if we have it turned off we'll see both the cases now if i scroll down here i'm going to get many different options related to the orientation and color mode and so on so now here in this case you see all of the values are looking in green color so one thing is i'm just going to change the background so in the color mode i'm going to select background okay now let's say we want to have all this value shown in a different color so in that case we need to add threshold so i'm going to go to field and here in the threshold i'm going to add some other threshold so let's say all the values from base until six we want to be in a different color and then anything which is around 27 we want it to be in a different color and then we also going to add another threshold which is 28 and then i am going to add one more threshold which is 60 and above okay so now you see all of these blocks have different colors based on the threshold color which is given here and again if you want to change the color for example let's say you want to change this color then you can click on this color and you can pick either one of the from one of the available colors let's say if i want to change it to purple i can do that or if you want some custom color then you have an option of specifying custom color here or selecting custom color from here so in this case this looks fine so we can just go ahead with this and now again i'm back to panel so here we will see what happens if we change the orientation from auto to horizontal so basically when you select auto it has by default is giving you vertical orientation now if you want this data to be shown into horizontal orientation then you can do that so this is how horizontal orientation is going to look like in this case i what i feel is that it is not visually appealing so either you can just stick to vertical or you can just click auto which is basically grafana is going to choose the best possible visualization for you now you can click on apply and then it is going to be shown here now again you have an option to minimize or maximize now one thing you can notice the one which we created just now is having absolute value and the one which was previously created is having percentage value so now let's say you want to show percentage here as well so in that case you can click on this title again and click on edit and now once you go to field you have something called unit again based on the kind of data you have for example if you you are trying to show sales value in that case you can select you need to be you know kind of dollars or money related in this case however i'm just going to select it to percentage so in order to do that you can just start typing unit and in the unit once you type p or per you are going to see the value of percentage so in this case i'm going to select percentage and now you can see value has changed from absolute to percentage if you had any other unit you could do that so if you have this you know you are showing some sales or revenue then you can select currency so in this case let's say if it had been sales then i could have selected dollars however in our case we know this is a disk utilization and it is more appropriate if we are selecting percentage unit and then you can save and or if you just want to see it you could have just clicked on apply in this session we will learn about grafana variables now variables are very useful when you have problem statements such as you want to make a selection of few subsets in when you have large amount of data available so for example in this case let's assume you had around 20 servers and out of those 20 servers you could have seen like you know hundreds of mount points combining all of those 20 servers now let's say if we are interested only on couple of servers then how can we give end user an option to select only the selected servers and then he can see the details of only those selected servers so now in order to do that we have something called variables in grafana so to enable variables you can click here on settings okay so you need to click on dashboard settings do not go here in the configuration you need to select it from here in the dashboard settings now once you click on that you will be noticing there are several options available so from these options on the left side we need to click on variables now under the variables click on add variable now here you can assign a name to this variable and i will show you where it that variable name is going to appear so let's call it hosts list and now the type of variable which we are going to define is a query so basically what i'm going to do is i have a query which is going to give me list of all the hosts okay so notice here this query is going to work only on influx db if you are using mysql or any other database or basically any other data sources in that case you need equivalent query in that data source so let me show you what is the output of this query in influx db so i'm going to login to the server where we have installed influx db and here if you want to interact with influx db in command line mode you need to type influx hit enter now you need to specify which is the database or schema which you want to connect to so in this case we want to connect to telegraph schema so i'm going to say use space telegraph and then you can paste this query so what this query is doing is in terms of influx db basically this is going to show me all the values which are available under host key so we know in host key we have three servers which is it panther 02 03 and 04 okay so that's why i'm going to use this query now right now you notice here at the bottom we do not have any option available okay so now as soon as i'm going to paste the query you will see the output of that query appearing here okay so before we do that we also need to make sure we select the correct data source so in this case we want to connect to influx db demo this is the one which we had created and in the query i'm going to paste the query so now notice once you paste the query and click anywhere else this is going to get evaluated and now here in the preview of values you are going to see the values so as you could see here we had three values it panther 02 03 and 04 so now here in the variable values we can see those output so for now i'm just going to click on add and then i will show you how it is going to look like in the dashboard so once you click on add this is how it is going to show here on the variable screen now you can click on save dashboard and then you can go back and you'll be able to notice a change now here you see this is the name which we had given so we had given host list and here we can see list of all the available hosts okay now let's say if i select it panther 03 in that case it should have shown me data here only for it panther 03 but right now we do not see that happening the reason is that we also need to use this variable name in the where clause so i'm going to edit this panel so i'm going to click on edit and then here in our query we need to make use of this variable which we had defined okay so in the where clause now i'm going to add host and here in the tag value we need to specify this variable so you notice this variable has started coming now once you define variable previously this was not available so now i'm going to select this and now you can see as soon as we defined or added this variable in our where clause now we can see based on the selection our data set is changing so if i had selected it panther 02 this output is changing and now we are seeing only hosts related to it panther 02 so i'm going to click on apply and now let's see how it is going to look like so as a end user which is having only view only facility like you know your monitoring team they are the one they'll be able to make a selection or here and based on that they'll be able to see the values changing here now let's say in this case user is having option of selecting only one server now let's say we want to select multiple server so what is the change we had to do in that case you can go again to dashboard settings you can go again to the variables and you have an option to update your existing variable so in this case this variable is here so i'm going to click on this variable and then here see in the multi value right now it is disabled so by default it remains disabled now we are going to enable this once we enable this user will have an option to select multiple values now once you did that click on update and now click on save dashboard again or if you don't want to save dashboard you can just come back here so now in this case you see now this has changed from a single selection to a multiple checkbox now i have an option to select let's say i can select it panther zero two and i can select it panther zero four so once i do that now you see the value has changed here and it is showing me details of two servers it is showing me details of it panther zero two and it panther zero four servers now consider one more scenario let's say you had list of around 20 or 30 servers and you wanted to see all the you know server details in that case you it is very inconvenient to select all the hosts one by one so for example in this case if i want to see all the three hosts it is very inconvenient to select all the three hosts one by one however if i select all the three hosts i'm able to see all the values now it had been nicer if we would have something called all in the beginning so if we had selected all it would have shown us all the values so we can do that in grafana and to do that again we need to go to dashboard settings and go to that variable which you have defined click again on the variable definition and now here next to multi value you see an option which is called include all option so once you enable that it is going to show you a value which is called all and once you select that you will be able to see all the hosts okay so again in the preview of value you can see there is one more option has been enabled which is called all so now let's click on update click on save dashboard and then i'm going to go back and now if we select here now we can see we have an option which is called all so let me unselect everything and we are just going to select all so now you can see even if we select all now we are able to see all the host value if we want to select only one host we could do that so in this case once i change to it panther 02 i see value or data related to only it panther 02 so let's change it to all again and now we can see this now let's say if you you don't want to show this name you just wanted to show the value so you can do that as well in that case you can click on dashboard setting you can go to the variable again and click on variable definition now you have an option of hide so in the hide you can click on label okay so in that case whatever label you had given that is going to be hidden however in this case please notice what is going to be the result okay just make make a note that we have selected label in hide and let's see what happens okay so now you see here we do not have label in the beginning now we see only the value so user can make a selection of the value and based on that they'll be able to see the options available here now let's say rather than seeing the default value we wanted something we still want label but we want to give a some logical name to that label so in that case we can do that as well so i'm going to change this hide to blank and in the label let's call it all servers okay now let's click on update and click on save dashboard go back and now we should be able to see all servers so this is the one which looks more logical and it looks more better so now you saw how we created variables using influx dv as a data source now let's say you had another data source which is MySQL in this case so how we could use that so everything else is basically going to stay the same you're still going to click on new variable and here you are going to give some logical names so let's call it MySQL hosts and i'm going to leave it to query and in the data source we need to select the data source which is pointing to MySQL so in this case we have matrix data source this is the one which is pointing to MySQL okay now let's say i'm going to go to the server where we have MySQL installed and i'm going to connect to MySQL i will show you how it is going to look like here and then we'll be using the same query there in grafana so if you remember under the grafana dv data base we had created a table which is called matrix and now we are going to see what is the value available there so let's click on or less query using select star from matrix and you can see it is giving us so much data and this is the column which we are interested in the name of this column is host so i'm going to say select host from matrix and now if you see it is giving us so many records now we don't want so many records we just want distinct hosts so in this case i'm going to select distinct host from matrix and now i get only the host names now notice in this case we had only two names available that's why it is showing us only two results so i'm now going to use this query and going to paste here in the query again notice in the preview right now we do not have anything available so once i paste the query here and click on the blank area now this query is going to get evaluated and now we are able to see the values available here again one you can enable multi value you can include all options so whatever we have done using influx db all those options are available with all the different data sources so now once i click on add i should be able to now see that in the dashboard as well so i'm going to go back and here now we can see my sql host also coming here now again we need to use this in one of our queries and then only it is going to reflect now in all our query we have just used influx db data source so this doesn't make sense in my case however in your case if you are using visualization using my sql database in that case you can make use of this variable in this session we are going to see some of the other advanced options available while we are configuring any visualization so let's click on add panel and in this case i'm going to select data source of influx db demo and in the visualization we have selected graph so let's create a query in order to see what is the cpu utilization on one server which is itp enter zero two and we will see a cpu utilization for each of the course so in the server which we have we have two cpu course available so let's say we are interested to see the cpu utilization of those course so here in the form i'm going to select autogen in the measurement i'm going to select cpu and now here in the select i'm going to change it to usage system and here i'm going to change rather than average let's say i'm interested in seeing the mix utilization so i'm going to change the selector to mix and also i'm going to add a group by in group i'm going to select tag cpu and then this is going to show us the value of all the available cpu's so now you can see we have cpu zero we have cpu one and what we also have is cpu total so first thing is i don't want to see this cpu dot max cpu these things so i'm just going to use alias by which is tag underscore cpu so this will get rid of all those things now we can see only cpu zero one and cpu total the other thing which i don't want here is i don't want to see cpu total so when you have multiple series and you are not interested in seeing data of one of the series in that case you can apply filters and filters are to be applied in wear clause so in this case i need to add a filter on cpu and i'm going to change it to not equal to because i want to i don't want to see cpu total so in this case i'm selecting cpu not equal to and in the select tag value we can change it to cpu total now you can see we don't see data related to cpu total now here on the panel if you see we are seeing dots we don't see a connected line that is because here in the null values we need to select connected okay now we can start going one by one option and start seeing what are the other available options so in this case you are already aware of all of these options which we have all also discussed in the past so now we can discuss about our tooltip so whenever you move your cursor here on this panel you see whenever you keep on cursor on any of the series it shows you information about both the series so here you in the output you can see it is showing you cpu zero as well as cpu one now let's say you you are only interested in seeing the value of the highlighted series in that case you can change the mode from all series to single now notice when i hover over mouse to cpu one series in that case i'm seeing data only for cpu one and when i hover over to this green series or which is cpu zero in that case i see data only for cpu zero again let's change it to all series so when you do all series you get for both now you can also decide on what when you have selected multiple series you can decide whether you want to see the data in ascending or descending order in that case you can change here short order from increasing or decreasing so let's say if i keep it increasing in that case you can see cpu zero is coming on cpu zero is coming on top because cpu zero is basically the value of cpu zero is less and the value of cpu one is more now if i change it to decreasing in that case if i hover over my mouse here now you can see the value of cpu one is more that's why it is coming on top and the value of cpu zero is less that's why it is showing on as a second available option okay so that's how you can sort the order of all of these series values again this is only going to reflect when you are hovering over because these these are under hover tooltip now the other important thing here is let's say you have these two series and you want to change the formatting of one of the series okay let's say the one which is called cpu zero you want a different formatting for this series okay in that case you can use series overrides so here in the series overrides you can click on add series override and here you need to provide one of the field so in this case if you click on this you are going to get all the available series and i'm going to select cpu zero because this is the one which you want to override and now let's change it let's say we want to change the line width okay let's say i want to make this series bit thicker so in that case i'm going to select line width of eight so now you can see the green one which is cpu zero the width of that series has increased so this is just one effect if you want to change it to some different effect you can do that as well now notice i'm just going to change it from cpu zero to cpu one and now you can see cpu zero is having very small width and cpu one is now the width is increased okay so this is very useful when you have multiple series here and then you want to highlight one of the series or maybe there is some important series and you want to highlight that separately so in terms of production servers you can have one of the servers which is very critical in that case you can reformat or you can change the formatting of that series now let's see about axis so in axis we have y axis and x axis so whatever you see here is y axis and whatever you see here which is like time values these are called x axis okay so in some situation let's say if you don't want to see values available here which is 0 10 20 30 40 50 60 so you have an option to hide this right now you see this show is enabled so you can click on this to disable it now notice here on the left side you do not see y axis so i'm going to enable it again and now let's say you are interested in seeing value only which is above 20 20 percent okay so in that case you can change the minimum value from auto to 20 so i'm going to change it to 20 and now notice here you see now this y axis is beginning with 20 so you don't see any series or any value which is less than 20 so this can be very useful when you want to focus on certain threshold and again similarly you can control mix value as well now again on x axis you have an option to enable or disable x axis so now here you see you are seeing time now let's say if i want to disable it i can disable this show option and now you can see x series has completely been turned off i'm going to turn it back on and now here in the mode you can see we have time so that's why here on the x series we are seeing time grafana is actually popularly used for time series kind of analytic analytics however let's say if you want to change it from time to any other thing like series you can do that as well so let's say we are interested in seeing maximum utilization by cpu we don't want to we don't care about the time we just want to see maximum cpu utilization in last five minutes so here you see we have selected last five minutes and in that case if i change it to series it is going to show me data of both the cpu now notice cpu zero is not having any data the reason being is we have put this y min so i'm going to remove this now you see for cpu zero the utilization is around 14 and for cpu one utilization is 1.2377 so you see the value here which is showing is very high the reason for that is when you select mode series in that case you also need to change the values so here in the values by default total has come that's why we are seeing different or very high cpu utilization here okay so what it has done is for last five minutes whatever data it had collected it is aggregated that and it is showing the sum of all that so that's why we see very high value however we are interested in the max value here okay so i have changed it to max now you can see data is coming properly so maximum cpu utilization for cpu one has gone 59% in last five minutes and for cpu zero it has gone to 2% in last five minutes now in this case you see we don't get we are not seeing time here on the x series i'm just going to change it back to time series and now let's see about legend so in the legend we have an option to enable or disable it so you see here you are able to see cpu zero and cpu one these are the one which are called legend so i'm just going to disable it and you will notice now the cpu zero and cpu one has gone from here i'm just going to enable it again and now if you see this cpu zero and cpu one is just showing next to each other and if i click on as table and enable this now you can see this has been changed to a tabular format so we are seeing cpu zero and cpu one in a different row so this information is more like a sequential information and it is not coming next to each other this is very useful when you also want to show min max and average kind of information so before that if you don't like legend to be shown here you can change it to the right side by enabling to the right option so once you enable that legend is going to move to the right side now here you notice this panel is showing us the max utilization of both the cpu course cpu zero and cpu one however let's say we are also interested in knowing the other statistics like minimum cpu utilization so in that case we can enable minimum value and for max we can enable max value for average we can enable average for current we can enable current again notice here whatever is the minimum utilization which it has observed in last five minutes that's the value which is going to come here okay it is not showing us exactly the minimum utilization of cpu one it is showing the minimum value which it has noticed on this series in last five minutes if you want to see the minimum you know utilization in that case you may have to change here in the query in the query we are still taking max so if you want to see the minimum utilization for each of the cpu course you have to change in the query however the minimum which is shown here is the minimum value in last five minutes which is being displayed here okay so don't get confused with the minimum which is shown here and the minimum which is available here in the aggregate function okay again if you want to enable total you can do that as well now notice here if i have turned off as table in that case i have like you know the data would have come like next to each other which is not that much effective and we can that's why change it to as table and it looks more better when you have these kind of information shown as a tabular format now you have an option to hide the series if there are no values or there are only null values so you can enable nulls and zeros in my case it is not going to make any difference because i don't have any series with only null values or only zeros so threshold we have already discussed so other than this the other important thing is links so let's say you want to give a link a reference so that after seeing this panel user can take some other action in that case you can enable some hyperlinks so here you can click on the add link and you will get an option to let's say i want user to login to service management tool or let's say we want to redirect user to some other documentation page so you can do that so in this case let's say let's call it read more and here i'm going to call it so it is just going to be any link let's just give google.com but in actual your environment it should be the link of some service management tool or you can put the link of some other dashboards so for example you can have a summary and then you can give a link of a detailed dashboard so once user sees the summary if he's interested in more details or granular level of details they can then click on this url which is going to take them to that dashboard and also if you want this url to be opened in a separate tab in the browser you can click here on open in new tab and this is going to enable whenever user clicks on this url it is going to be opened in a new tab now we can save this and now you notice once we save that here on the left side we have one link enabled and we can see read more option here so once we click on read more it is going to open this link on a new tab i'm not going to do that it's just very simple so now you have seen all the options which are available here some of the options i have not explained because those are not really used much and in case you want to read about read more about these options you can go to grafana website so in this session we are going to learn how you can embed any grafana panel in any of the html website using iframe so let's say this is the website which we have so this is just a simple html page which i have created and this is the code of that html okay so this is pretty simple there is nothing much here we just have html tags and in the body we just have some sample codes and then what it is doing is it is it has created a simple web page which is printing this message basically just a bit of text which i have put out there now what we are going to do is i also have a grafana panel and this panel we want to embed in this html okay now using this approach you can embed grafana panels on any of existing website okay so the step is basically going to be pretty much same you we are just going to use iframe in order to embed grafana panel on this website now the step is very simple but before we do that step there are some changes which we need to make in the grafana configuration file if you don't do those changes in that case it is not going to work and i have been just browsing through and i have been just actually checking some of the community questions and i saw many people are struggling on this because the configuration changes which they are supposed to make they haven't made and they are just trying to embed this panel in html website and that's why they are facing problem so let's begin by making changes in configuration files so for that what we need to do is we need to make changes in slash etc slash grafana slash grafana dot ini file so this grafana dot ini file may be at different location based on the which place you have installed grafana if you have followed the tutorial of this course then in that case you just need to go at this place and need to make changes in grafana dot ini file and the parameters which you need to make changes in is called allow embedding so by default allow embedding is set to false so you need to change that to true and in the auth dot anonymous section you need to change enable to true and then org name you can just give the org name in my case i just left it to default and org role you need to give any org role which you have created if you don't have anything just leave it to default which is going to be viewer so where you see these settings in order to see all of these configuration you can just go to settings and then you can so here you can go to server admin and then you can click on settings and here in the settings you can just verify all of these settings so for example let's search with embedding and now you can see here allow embedding is set to true because i have already made this configuration changes but in your case you are going to see that by default it is going to be set to false so if you see this is set to false it means you need to make changes in configuration file and similarly you can also verify about anonymous parameter so here you can see auth dot anonymous by default enabled is set to false in my case i have already made changes here so that's why it is showing as true org name i have just left is default org role also i have left as a default now let me show you from the back end so here this is a grafana.ini file which we need to make changes in so i have opened it in vi editor and then we are just going to search with embed and here you can see that allow embedding is set to true okay by default it was set to false now i have already made changes and set it to true also make sure whenever you make any changes you remove a semicolon which is in the beginning of this statement okay so after this we need to search about anonymous so you can use any editor which you want in my case i'm just using a vi editor but you can use any editor so in this case enabled was set to false i have changed enable to true and also remove semicolon which you are going to see in front of enabled so remove any semicolon which is prefixed here and here in the org name you can give any org name if you have created if you have not created anything just remove semicolon and leave everything else as it is and similarly in org role just remove this semicolon from the beginning and leave the everything as it is if you have not made any or you have not created any org role so these are the changes which you need to make and after that just save and exit from here and you also need to restart grafana so in order to restart grafana all you have to do is you can use a sudo space system ctl space restart space grafana hyphen server hit enter and then you are going to basically restart grafana and once you are done with that again go back to the panel which you have created and then now we are going to actually use the steps which are going to help us in embedding this panel in html website so what we need to do is click here on the title of this panel and then we are going to see options so here from the available options we are going to click on share so from share now you can see you have three options we have link we have snapshot we have embed so what we need to do is we need to select embed so once you click on embed these are the code which we are going to use so i'm just going to copy everything just copy everything and then we need to make changes in the this html file so in this case i'm just going to paste whatever we have copied here and what it is basically doing is it is creating an iframe and in that iframe it is going to embed this panel and by default this is the width and height which is going to be you can make changes here someone who's dealing with web development he'll be understanding what are the changes which can be made here but this is basically pretty simple thing and once you are done with these changes just save it and now you can go back to your website and just refresh your website and in that case now you should be able to see now you can see that the dashboard weather trend panel has been embedded here and i'm able to see this here on my website so that's how easy it is in order to set up or in order to embed any panel grafana panel in any of the existing website if you have any question please feel free to ask in qna section i'll be more than happy to answer