Introduction :
Every application that is deployed on production needs some kind of monitoring to see how the application is performing. This will give you some insights on whether the application is performing as expected or if you would need to take some action in order to obtain the desired level of performance. In the modern world, this data is called Application Performance Metrics (APM).
Today we will be looking at two open-source tools called Grafana and Prometheus. Prometheus gathers and stores metrics data in a time series format while Grafana uses Prometheus as a data source to visualize the data on dashboards.
Prerequisite :
- Java
- Spring Boot Application should be enabled actuator and prometheus
- Docker: Both Prometheus and Grafana can be run as Docker containers. Therefore, you need to have Docker installed on your system.
https://www.docker.com/products/docker-desktop/
Prometheus Configuration :
- Download Prometheus docker image using below cmd
docker pull prom/prometheus
- Download prometheus.yaml file from below link
https://www.mediafire.com/file/zabiamfbv8viuyt/prometheus.yaml/file
You will find file like below snapshot
Replace endpoint to your service endpoint like http://192.168.29.155:8080/
- Open terminal and hit the below command
docker run -p 9090:9090 -v <replace with your downloaded prometheus.yaml file path>/prometheus.yml prom/prometheus
- Open chrome browser and hit url http://your-system-ip-address:9090
Select any metric and click on execute
Grafana Configuration :
- Download and run Grafana docker image using below cmd
docker run -d -p 3000:3000 grafana/grafana-enterprise
- Open chrome browser and hit url http://your-system-ip-address:3000
Add Datasource
Move the cursor over the Prometheus Time series database
Enter the endpoint url of the prometheus server in the URL text box below. And click on Save & test
Create new dashboard
Select any metric from list and click Run queries


