Prometheus is popular opensource monitoring tool. It can monitor applications with help of JMX Exporter Java agent.
This Article demonstrate the Liferay Portal Server Monitoring with Prometheus.
Prerequisite
Install Liferay Cluster
http://www.liferaysavvy.com/2021/07/liferay-portal-apache-webserver.html
- Download JMX Exporter
- Configure JMX Exporter for Liferay Portal Servers
- Start Liferay Portal with JMX Exporter Agent
- Install Prometheus
- Configure Prometheus scrape for Liferay Portal Servers
- Verify Liferay Cluster in Prometheus
Download JMX Exporter
Download JMX Exporter jar file from following location.
https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.16.1/
Direct link for latest JMX Exporter JAR
OR
Download and get the jar to local directory.
Configure JMX Exporter for Liferay Portal Server
We need to configure the exporter configuration for Liferay Portal Server such a way JMX agent exports the required metrics from Liferay Portal Server.
Get the following JMX Exporter configuration file from below location and place it in local drive.
https://github.com/prometheus/jmx_exporter/blob/master/example_configs/tomcat.yml
OR
https://github.com/LiferaySavvy/liferay-monitoring-prometheus/blob/master/tomcat.yml
We can use below one too.
lowercaseOutputLabelNames:
true lowercaseOutputName:
true rules: - pattern:
'Catalina<type=GlobalRequestProcessor,
name=\"(\w+-\w+)-(\d+)\"><>(\w+):' name: tomcat_$3_total labels: port: "$2" protocol: "$1" help: Tomcat global $3 type: COUNTER - pattern:
'Catalina<j2eeType=Servlet,
WebModule=//([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]),
name=([-a-zA-Z0-9+/$%~_-|!.]*), J2EEApplication=none,
J2EEServer=none><>(requestCount|maxTime|processingTime|errorCount):' name: tomcat_servlet_$3_total labels: module: "$1" servlet: "$2" help: Tomcat servlet $3 total type: COUNTER - pattern:
'Catalina<type=ThreadPool, name="(\w+-\w+)-(\d+)"><>(currentThreadCount|currentThreadsBusy|keepAliveCount|pollerThreadCount|connectionCount):' name: tomcat_threadpool_$3 labels: port: "$2" protocol: "$1" help: Tomcat threadpool $3 type: GAUGE - pattern:
'Catalina<type=Manager,
host=([-a-zA-Z0-9+&@#/%?=~_|!:.,;]*[-a-zA-Z0-9+&@#/%=~_|]),
context=([-a-zA-Z0-9+/$%~_-|!.]*)><>(processingTime|sessionCounter|rejectedSessions|expiredSessions):' name: tomcat_session_$3_total labels: context: "$2" host: "$1" help: Tomcat session $3 total type: COUNTER |
Start Liferay Portal with JMX Exporter Agent
It’s required to start JMX Exporter agent with Liferay Portal. Set JMX Exporter java agent in JAVA_OPTS in setenv.bat file of Liferay Portal.
JAVA agent syntax
-javaagent:C:/kafka-workspace/kafka-monitoring/jmx_prometheus_javaagent-0.15.0.jar=<port>:<exporter-config-file-path> |
Set JAVA_OPTS in Liferay setenv.bat file. Locate
to tomcat bin directory and update setenv.bat file with following JAVA_OPTS. This
need to be update in All Liferay Portal Servers in the cluster.
Liferay Portal Node1
https://github.com/LiferaySavvy/liferay-monitoring-prometheus/blob/master/setenv-node1.bat
set
"JAVA_OPTS=%JAVA_OPTS%
-javaagent:C:/kafka-workspace/kafka-monitoring/jmx_prometheus_javaagent-0.16.1.jar=7171:C:/kafka-workspace/kafka-monitoring/tomcat.yml"
|
Liferay Portal Node2
https://github.com/LiferaySavvy/liferay-monitoring-prometheus/blob/master/setenv-node2.bat
set
"JAVA_OPTS=%JAVA_OPTS%
-javaagent:C:/kafka-workspace/kafka-monitoring/jmx_prometheus_javaagent-0.16.1.jar=7272:C:/kafka-workspace/kafka-monitoring/tomcat.yml" |
Start Liferay Node1
Open command prompt and locate Liferay Portal Tomcat bin directory and use following commands.
cd C:\Liferay\Liferay74\liferay-ce-portal-7.4.1-ga2-node1\tomcat-9.0.43\bin startup.bat |
Start Liferay Node2
Open command prompt and locate Liferay Portal
Tomcat bin directory and use following commands.
cd C:\Liferay\Liferay74\liferay-ce-portal-7.4.1-ga2-node2\tomcat-9.0.43\bin startup.bat |
Now Liferay Portal servers started with JMX Exporter
agent.
Make sure all JMX Exporter are started successfully and
we can access metrics with following URL’s. We are running all java agents in
same machine, its required to change ports accordingly.
|
Install Prometheus
Follow the below URL and Install Prometheus.
http://www.liferaysavvy.com/2021/07/prometheus-installation-on-windows.html
Configure Prometheus scrape for Liferay
Portal Servers
Locate to Prometheus directory and update “prometheus.yml”
file with following Liferay Portal Server scrape.
Find the file from following location
https://github.com/LiferaySavvy/liferay-monitoring-prometheus/blob/master/prometheus.yml
- job_name: 'liferay' static_configs: - targets: ['localhost:7171','localhost:7272'] labels: env: "liferay-dev" |
Targets should be JMX Exporter java agent host:port.
Complete “prometheus.yml” file
# my global
config global: scrape_interval: 15s # Set the scrape interval to every
15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules
every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global
default (10s). # Alertmanager
configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules
once and periodically evaluate them according to the global
'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape
configuration containing exactly one endpoint to scrape: # Here it's
Prometheus itself. scrape_configs: # The job name is added as a label
`job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] - job_name: 'liferay' static_configs: - targets:
['localhost:7171','localhost:7272'] labels: env: "liferay-dev" |
Start “Prometheus”
Open command prompt and locate to “Prometheus”
root directory. Use the following start command and pass web listen address
and config file as options.
prometheus.exe
--config.file prometheus.yml --web.listen-address ":9090"
--storage.tsdb.path "data" |
Verify Liferay Cluster in Prometheus
Access “Prometheus” web interface with following URL and its running on 9090 port.
|
Targets Status
Go to Status menu and click on targets so we can see Liferay
cluster health for each Node.
We can see Liferay Portal Cluster health in the Prometheus.
|
Hi this is a wonderful article. I’m going to share this to my friends. I came on this while browsing on google I’ll be sure to come back. thanks for sharing. We are Please Visit us letter pads
ReplyDeleteDating remedies will definitely allow consumers to develop an account in addition to uncover appropriate 'matches' to engage with visit here. Messages will absolutely be traded quickly, cheaply, as well as additionally safely, without the security problems of seminars in the real world.
ReplyDeletehttps://saglamproxy.com
ReplyDeletemetin2 proxy
proxy satın al
knight online proxy
mobil proxy satın al
XJQ8