DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Monitoring Spring Boot Applications with Prometheus and Grafana
  • Visualizing Exposure Bias Using Simulation
  • Building a Simple AIOps Monitoring Dashboard With Prometheus and Grafana
  • Enhancing Business Decision-Making Through Advanced Data Visualization Techniques

Trending

  • Delegated Transport, Forked Authorization: Where Chat and AI-Agent Integrations Actually Break
  • How You Clear Your HTML5 Canvas Matters
  • Guess the Speed: Building a Family Internet Speed Guessing Game
  • Supercharging AI Agents with Azure Context: A Hands-On Guide to Azure MCP

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Data
  4. Creating Visualizations in Grafana

Creating Visualizations in Grafana

For those getting started with Grafana for monitoring, this tutorial will help you create a visualization using your Prometheus metrics.

By 
Satish Sharma
·
Aug. 23, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
46.6K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

In this article, we will learn how to create visualizations in Grafana for monitoring. Our aim is to create a visualization that shows the hit count of an endpoint.

Assumptions

  1. You have a REST application which exposes Prometheus metrics as an endpoint (in our case, http://localhost:9000/actuator/prometheus). Follow this article for a step by step guide to expose metrics. You can get the application I used from this GitHub repository.
  2. You have a working instance of Prometheus and Grafana running. If not, follow the steps in this article to set things up and running.

Let's create our visualization following the steps below:

  1. Add your metrics endpoint as a datasource in Grafana. You can follow this article for a step-by-step guide.
  2. Create a visualization
    1. Click in the "+" icon on right sidebar.
    2. From the Create menu, select "Dashboard."dashboard
    3. Select "Singlestat" in the "add" tab in a new panel (as we only have a single count gauge).Image title
    4. A blank panel will be added to the screen. Click on the drop-down icon on the panel title. Select "Edit" from the options.Image title
    5. Select "General" from the tabs. You can edit basic information from this screen. In the title section, you can rename the title for the panel — let's say "Get Person Count."Image title
    6. Select the "Metrics" tab and from the "Data Source" drop-down, select "prometheus-local" (remember that we added this as our datasource in an earlier step). Add the below query in the query section provided: http_server_requests_seconds_count{exception="None",instance="localhost:9000",job="person-app",method="GET",status="200",uri="/person"}Image title
    7. In the "Options" tab, click on to the checkbox for "show" in the Gauge section. You can change the colors and other options if you want to.Image title
    8. Save the changes by pressing "CTRL + S". Enter comments and click "save."Image title
    9. You should be able to see the total hit count for the "/person" api in a guage.Image title
    10. Congratulations! We got our gauge showing the total hit count. Below is a sample dashboard created for JVM monitoring.Image title

In our next article, we shall be monitoring a MySQL database using Grafana.

Visualization (graphics) Grafana

Opinions expressed by DZone contributors are their own.

Related

  • Monitoring Spring Boot Applications with Prometheus and Grafana
  • Visualizing Exposure Bias Using Simulation
  • Building a Simple AIOps Monitoring Dashboard With Prometheus and Grafana
  • Enhancing Business Decision-Making Through Advanced Data Visualization Techniques

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook