Getting started with Grafana and Prometheus

Reading Time: 2 minutes

In this blog we are discussing about grafana and prometheus, and some steps how we can setup grafana in our system.

We’ll have a look at:

  • What is Grafana
  • How we can use Grafana
  • What is Prometheus
  • how to setup Prometheus

1-What is Grafana

 Grafana is an open-source solution for running data analytics, pulling up metrics that make sense of the massive amount of data & to monitor our apps with the help of cool customizable dashboards.

Grafana connects with every possible data source, commonly referred to as databases such as Graphite, Prometheus, Influx DB, Elastic Search, MySQL, PostgreSQL, etc.

2-How we can use Grafana

Grafana also provides a huge list of community like Grafana Labs ,Prometheus, supported panel plugins that enable users to create visualisation with options such as world maps, heat maps and pie, bar and line charts.

But in this blog we will discuss about Prometheus.

3-Prometheus

Prometheus is an open-source data monitoring tool. The combination of Prometheus & Grafana is the de-fact tool combination in the industry for deploying a data visualisation setup. Grafana dashboard is popular for visualising the data whereas the back-end is powered by Prometheus.

4- Let’s see how we can install Prometheus in our system

please follow all the steps :

1: Update the yum package repositories.
sudo yum update -y
2: Go to the official Prometheus downloads page and get the latest download link for the Linux binary.

or

You can directly run the following command

wget https://github.com/prometheus/prometheus/releases/download/v2.35.0/prometheus-2.35.0.linux-amd64.tar.gz

Using this command you can easily download the Prometheus on your system.

Once you download this source code then you will get tar file

3 : Now you need to unzip the file.
tar -xvf prometheus-2.35.0.linux-amd64.tar.gz
4 : You need to go to the root directory.
cd prometheus-2.35.0.linux-amd64/
5 : Now we need to update the prometheus.yml file.
cat prometheus.yml

6 : In this file you need to add a new job regarding your project.

job_name: 'spring-actuator'
    metrics_path: '/actuator/prometheus' 
    scrape_interval: 5s
    static_configs:
    - targets: ['localhost:9093']

For adding Prometheus in our project we also need some maven dependency’s.

 <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <version>1.7.0</version>
        </dependency>
 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
7: Once you are done with the all the steps you just need to run the prometheus exe file.
./prometheus

Go to the browser and run http://localhost:9090

If you see the above image when accessing the localhost that means Airflow has been successfully installed on your system.

That’s it for this blog folks in the next blog we will learn about Grafana , Thanks!

Stay Tuned for more blogs on Apache Airflow on: https://blog.knoldus.com/

Written by 

Gaurav srivastav is a Software Consultant working in java domain.