Grafana Dashboards for Prometheus Metrics

This is a short, last article to complete the installation of a comprehensive Monitoring and Alerting system for cloud-native applications with Prometheus. In the previous articles we looked into the concepts and the steps to setup and integrate Prometheus server, alert-manager, Prom2teams and a dead man’s switch. So now we are going to setup our Dashboards for the monitoring system using Grafana to give a graphical representation for system’s alert rules.

Grafana

Why Grafana?

  • opensource
  • can create graphs and dashboards easily
  • fast, client-side rendering even over long ranges of time
  • work with multiple time-series data stores (eg: Graphite, Prometheus, Elasticsearch, InfluxDB, MySQL etc)

Grafana has it’s built-in alerting engine that allows users to create conditional rules to dashboard panels to triggered alerts to a notification endpoint of your choice (e.g. email, PagerDuty, Slack, custom webhooks etc). But in our setup we used Prometheus alert manager for alerting which is a better reliable tool specifically designed for this particular functionality with more alerting features such as alert grouping, repetitions etc.

Integration of Grafana with Prometheus

Once the Grafana server is up and running, the first step is to connect Prometheus server as a Grafana data source.

Grafana data sources

Grafana support integration with multiple data stores. In our case, we will be using Prometheus data source as the time series database.

Prometheus data source configuration

Provide your Prometheus server URL for the data source and test the connectivity using the test button provided in the same page. If you get a successful connection, then let’s create a new dashboard.

You can create dashboards,

  • manually by defining queries for each graph
  • importing an existing template

Below is how to create a dashboard manually by defining each and every data required to be displayed in the graph.

Create dashboards

You can directly use Prometheus queries in Grafana. So that is so easy to create these dashboards as long as you have collected all the required matrices in Prometheus server.

You can create as may as dashboards you need to cover every aspect of your application system. It provides several visualization plugins as Pie charts, graphs, tables, clocks and many more. You will get extra plugins for Grafana with the Enterprise version.

Sample Grafana Dashboard

Alerting from Grafana

Alert Configuration

The above is a sample alert trigger for average value of the query A created above in the image ‘Create dashboards’ exceeding a limit of 5 counts for a duration of 5 minutes. Similarly you can create any number of alerts for the Grafana queries created in the given visualization.

You can create more tech blogs here.

Thanks!

Senior Software Engineer | BSc (Hons) Engineering | CIMA | Autodidact | Knowledge-Seeker