Monday, July 26, 2021

Liferay Portal Monitoring with Prometheus and Grafana

Grafana is popular open-source solution for monitoring applications. It will provide graphical dashboards to build monitoring visualization.

 


Any graphical view required data or metrics, so metrics data will be provided by Prometheus.

 


Prometheus is another monitoring tools to pull data from different application with help of JMX Exporter Agent.

 


Grafana is ability to connect Prometheus to pull metrics data and it will be represented as graphical view. We can build nice dashboards to show metrics data in different graphical view in the Grafana web UI.







Prerequisite



Setup a Liferay Cluster



http://www.liferaysavvy.com/2021/07/liferay-portal-apache-webserver.html

 




Following are steps to Demonstrate Liferay Cluster Monitoring.

 


  • Setup Prometheus for Liferay Cluster
  • Install Grafana
  • Configure Prometheus Data source in Grafana
  • Create Liferay Cluster Dashboard

 



Setup Prometheus for Liferay Cluster



Follow the below article to setup Prometheus for Liferay cluster.



http://www.liferaysavvy.com/2021/07/liferay-portal-monitoring-with.html

 


After configured JMX Exporter for Liferay Portal, Start all servers in the cluster.

 




Install Grafana

 


Follow the below article to install Grafana on windows.

 

http://www.liferaysavvy.com/2021/07/grafana-installation-on-windows.html

 




Configure Prometheus Data source in Grafana



Now it’s time to configure Prometheus Data source in Grafana. Prometheus already have metrics data which is pulled from Liferay portal server with help of JMX exporter Java agent. That is already covered in the previous step.

 


Access Grafana Web UI with following URL

 


 

 

http://localhost:3000/

 

 

 


Home page click on Setting and Under Configuration click on “Data sources

 




 

Click on Add Data source.

 





 

Select Prometheus Data source in the List.

 





 

Provide Prometheus URL where its running. Default port is 9090. Once provided required information click on Test &Save.  Grafana successfully connected to Prometheus data source.

 


 

http://localhost:9090/

 

 




 





Create Liferay Cluster Dashboard



Grafana home page click on Dashboard icon and Click on Manage

 




 

There are free available Grafana dashboards for Tomcat. Creating Grafana dashboard is very easy and it’s just need to import Dashboard JSON file.

 


Go to following URL and get Grafana Tomcat dashboard file to local.

 

https://github.com/LiferaySavvy/liferay-monitoring-prometheus/blob/master/tomcat-dashboard_rev10.json

 

 

OR

 

https://grafana.com/api/dashboards/8704/revisions/10/download

 


Import “tomcat-dashboard_rev10.json” file into Grafana dashboard.

 


Click on import button.

 




 


Click on Upload JSON file button and Select “tomcat-dashboard_rev10.json” file from local drive.





 

Once selected file, click on import then Dashboard will be imported into Grafana.

 




 

 



 

 


Go to Dashboards in the Grafana home page and select Tomcat Dashboard.

 




 

We Can see Dashboard with many panels and all metrics will be represented as Graphs.

 


Dashboard Screen: 1

 




 

 


We can edit Dashboard based on metrics provided by Prometheus or JMX Exporter.

 


We can see all Metrics with following JMX URL’s and these metrics attribute keys are matching in Grafana Dashboard JSON file. This is how Grafana build dashboards based on JMX Metrics.

 


 

 

http://localhost:7171/metrics

 

http://localhost:7272/metrics

 

 

 




Author

 

0 comments :

Post a Comment

Recent Posts

Recent Posts Widget

Popular Posts