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.
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:
You can install the required plugins in a single step while running the container:
Once Grafana is up, it is accessible via http://HostIP:3000. The Default user and password is ‘admin.’
2. SETTING UP CONTAINER FOR PROMETHEUS
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:
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:
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.