WHAT IS GRAFANA?

Grafana is a multi-platform open-source visualization and monitoring tool that integrates with data from sources like Prometheus, InfluxDB, Graphite, and ElasticSearch. This software has been available since 2014. Grafana provides us a graph, the chart for a web connected to the data source. It can query or visualize your data source, and it doesn’t matter where they are stored.

WHAT IS PROMETHEUS?

Prometheus is an open-source system monitoring and alerting toolkit, which includes a rich, multidimensional data model, a concise and powerful query language called PromQL, and an efficient embedded time series database. The central Prometheus server scrapes and stores time series data. Most Prometheus components are written in Go, making them easy to build and deploy as static binaries.

PREREQUISITES

Ubuntu 18.04 server set, including a non-root user with Sudo privileges.

Install and Configure Docker.

Here, we’re setting up Grafana version 7 with Prometheus 2.17 version as a data source:

1. SETTING UP CONTAINER FOR GRAFANA-7.0

Pull the official image from the Docker hub and run the container: 

Copy to Clipboard

You can install the required plugins in a single step while running the container:

Copy to Clipboard

Once Grafana is up, it is accessible via http://HostIP:3000. The Default user and password is ‘admin.’

2. SETTING UP CONTAINER FOR PROMETHEUS

Copy to Clipboard

3. ADDING PROMETHEUS AS A GRAFANA DATA SOURCE

To make Prometheus the data source for Grafana, create a yaml file ‘datasource. yaml’  in the location ‘/etc/grafana/provisioning.’ A sample is given below:

Copy to Clipboard

We can set alert rules as a yaml file in the location ‘/etc/prometheus/’ of the Prometheus container. 

A sample alerting rule is given for reference:

Copy to Clipboard

About the Author

SREEDEVI J S

Senior Cloud DevOps Engineer | Cloud Control

Cloud DevOps Engineer with more than five years of experience in supporting, automating, and optimizing deployments to hybrid cloud platforms using DevOps processes, tools, CI/CD, Docker containers and K8s in both Production and Development environments.

About Cloud Control

Cloud Control simplifies cloud management with AppZ, DataZ, and ManageZ, optimizing operations, enhancing security, and accelerating time-to-market. We help businesses achieve cloud goals efficiently and reliably.

2024
GITEX
14-18 October

Dubai, UAE