Advertisements

Let’s create your first Grafana dashboard

Reading Time: 4 minutes

In my previous blog, we discussed the setup of Grafana-Graphite for JMX monitoring.  Now we will create a first Grafana dashboard where we will create Grafana queries to visualize JMX metrics stored in Graphite.

As we know, Grafana UI runs on http://localhost:3000/ by default so let’s open the URL in the browser with the default username and password which is admin: admin

login

After login either you can change the password or just skip the page.

Now we need to add data source first.

datasource

Click on the add data source and select your data source.

select_data_source

Here we are using Graphite as the data source, so let’s select the Graphite from the list.

graphite

Here, we need to add the Graphite URL. As Graphite UI runs on http://localhost (80 port by default), so let’s add it and verify the working of the data source by clicking on the “Save & Test” button at the bottom.

So the data source has been added. Now let’s go to the Dashboard page to create the dashboard. Click on the dashboard at the left side icon -> Manage

dashboard_page

Here, we have 2 options to create the dashboard. Either we can import or create the new one. If you have any existing dashboard json then go for import else click on the Dashboard option to create the new one.

Let’s click on the Dashboard -> Graph, you will get the following page:

new_panel

Here, we can create multiple panels as per our requirement. I am going to create only one here, so let’s start adding metrics. For this, we need to edit this panel by clicking on Panel Title -> Edit

metrics

First, select the data source as Graphite from the drop down just below the Metrics tab.

You can see there are multiple tabs, you can explore each and every tab by clicking on it.

We can change the name of the panel from the General tab. We will use the Metrics tab to create the Grafana queries. There is an Alert tab from where we can set up alerts which we will see in my next blog.

So let’s start creating queries. Just go to the Metrics tab and start clicking on “select metric” option. You will see some values there.

metrics_queries

There are 2 ways of creating queries:

  1. Select the value from the dropdown
  2. Directly add the query in edit mode.

Select the value from the dropdown: 

As soon as you will click on one of the value, you will get the “select metric” option again at the right side. You will continuously get this option until you reach to a concrete value. Metrics are stored in nested structure in Graphite. So all these options are those nested values.

Directly add the query in edit mode:

There is an option at the right side of the query “Toggle Edit Mode”. If you already have a query just paste the query there and close that edit mode, you will find the data on Graph.

Query example:

alias(sumSeries(kafka_connect_03.local.kafka.connect.type_connect-metrics.client-id_connect-1.incoming-byte-rate), ‘connect_metric’)

query_edit_mode

After finalizing the query, you can perform some functions as well on those values. You can see, there is an option of Functions, just below the Series. There are a lot of functions available which you can explore. I am using 2 functions here: sumSeries and alias.

sumSeries: It adds metrics together and returns the sum at each data point.

alias: It creates an alias for the fully qualified metrics name which is a very long name. See the example below:

Without alias:

without_alias

With Alias:

alias

You can create multiple queries by clicking on “Add Query” button.

That’s It. Hope this blog will help you to create your first Grafana dashboard.

Stay tuned for the next blog to set up alerts in Grafana.

Reference:

http://docs.grafana.org/

 

 

Knoldus-blog-footer-image

 

Advertisements

Written by 

Rishi is a Lead Consultant, with experience of more than 7 years. Rishi is product focused developer who loves developing both front-end user interfaces and scalable back-end infrastructure. He is a good team player, quick learner and a humble person. He has good time management skills, aimed to give best results and fully dedicated towards his work & responsibilities. He is able to work as individual and as well as in team. He loves to share his knowledge, therefore he often writes technical blogs.

Knoldus Pune Careers - Hiring Freshers

Get a head start on your career at Knoldus. Join us!