Tutorial - Visualizing metrics using Grafana

 

VISUALIZING METRICS.

In this tutorial we will create a simple dashboard using Grafana to visualize the ping_request_count metric .

If you are wondering why one should use a tool like Grafana when one can query and see the graphs using Prometheus, the answer is that the graph that we see when we run queries on Prometheus is to run ad-hoc queries. Grafana and Console Templates are two recommended ways of creating graphs.

Installing and Setting up Grafana.

Install and Run Grafana by following the steps from here for your operating system.

Once Grafana is installed and run, navigate to http://localhost:3000 in your browser. Use the default credentials, username as admin and password as admin to log in and setup new credentials.

Adding Prometheus as a Data Source in Grafana.

Let's add a datasource to Grafana by clicking on the gear icon in the side bar and select Data Sources

⚙ > Data Sources

In the Data Sources screen you can see that Grafana supports multiple data sources like Graphite, PostgreSQL etc. Select Prometheus to set it up.

Enter the URL as http://localhost:9090 under the HTTP section and click on Save and Test.

Creating our first dashboard.

Now we have successfully added Prometheus as a data source, Next we will create our first dashboard for the ping_request_count metric that we instrumented in the previous tutorial.

  1. Click on the + icon in the side bar and select Dashboard.
  2. In the next screen, Click on the Add new panel button.
  3. In the Query tab type the PromQL query, in this case just type ping_request_count.
  4. Access the ping endpoint few times and refresh the Graph to verify if it is working as expected.
  5. In the right hand section under Panel Options set the Title as Ping Request Count.
  6. Click on the Save Icon in the right corner to Save the dashboard.

Comments

Popular posts from this blog

Terraform

Scrum Master Interview help - Bootcamp

Kubernetes