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:
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: