How to Install & Configure Grafana Monitoring Tool on Ubuntu 20.04

Grafana is a free & open-source Monitoring tool. It provides some feature such as metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus, and InfluxDB.It is used for analysis and visualization web application.We can use charts, graphs, and alerts for web application logs.

Install Grafana on ubuntu

Update the system.

apt-get update

Install Required Key & Repository.

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
&
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

Update the packages.

apt-get update

Install Grafana.

apt-get install grafana

Start & Enable the Grafana service.

systemctl start grafana-server
&
systemctl enable grafana-server

Check the status of Grafana service.

systemctl status grafana-server

Here is the command output.

● grafana-server.service - Grafana instance
     Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
     Active: active (running) ; 13min ago
       Docs: http://docs.grafana.org
   Main PID: 4040 (grafana-server)
      Tasks: 11 (limit: 1160)
     Memory: 49.1M
     CGroup: /system.slice/grafana-server.service
             └─4040 /usr/sbin/grafana-server 

Open the port number 3000 on ufw firewall.

ufw allow 3000/tcp

Access Grafana web-interface.

https://server-ip:3000

Here is the output.

  • By default, admin is the user-name & password.

 

Fig 1

 

  • Change the password of Grafana.

Fig 2

 

  • Grafana is Ready.

 

Fig. 3

Install Pushgateway

  • It is used for push the logs.

Download the Pushgateway.

wget https://github.com/prometheus/pushgateway/releases/download/v0.8.0/pushgateway-0.8.0.linux-amd64.tar.gz

Extract the downloaded file.

tar xvzf pushgateway-0.8.0.linux-amd64.tar.gz
&
## Run the following commands
cd pushgateway-0.8.0.linux-amd64/   
./pushgateway & 

Install Prometheus

Setup Data source on Grafana.

  • Click on Configuration option.
  • Click on Data source.

 

Fig. 4

 

  • Click on Add data source.

 

Fig. 5

 

  • Select Data source based on requirement. Choose Prometheus.
  • Click on Select.

 

Fig. 6

 

  • Provide all the required values.
  • Provide URL: http://server-ip:9090.
  • Set Timeout.
  • Click on Save & Test.
  • Check data source is working properly.

 

Fig. 7

 

One response to “How to Install & Configure Grafana Monitoring Tool on Ubuntu 20.04”

Leave a Reply