Configure probe to monitor Tomcat

Download tomcat

https://tomcat.apache.org/download-70.cgi

Install tomcat on Windows

set CATALINA_HOME=F:\app\apache-tomcat-7.0.69

set JAVA_HOME=F:\app\Java\jdk1.7.0_79

start

Install probe

architecture overview

Download probe

https://launchpad.net/lambdaprobe/+download

https://github.com/psi-probe/psi-probe

http://code.google.com/p/psi-probe/ —newest version

—–>3.0.0-SNAPSHOT/

We download this version that it is psi-probe-web-3.0.0-20160603.023429-26.war

Install probe on tomcat in windows

 

tomcat-users.xml

edit $CATALINA_HOME/conf/tomcat-users.xml

Example1:

<role rolename=”manager-gui”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<user username=”admin” password=”admin” roles=”manager-gui,manager-script,manager-jmx,manager-status”/>

Example2

<role rolename=”tomcat”/>

<role rolename=”role1″/>

<role rolename=”manager-gui”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<role rolename=”poweruser”/>

<role rolename=”probeuser”/>

<user username=”tomcat” password=”tomcat” roles=”tomcat”/>

<user username=”both” password=”tomcat” roles=”tomcat,role1″/>

<user username=”role1″ password=”tomcat” roles=”role1″/>

<user username=”sss” password=”sss” roles=”manager-gui”/>

<user username=”admin” password=”admin” roles=”manager-gui,manager-script,manager-jmx,manager-status,poweruser,probeuser”/>

Enable Remote JMX

PSI Probe requires remote JMX to collect and display certain pieces of information (memory usage, cluster traffic, connection pools, and active threads). This is optional, but without it these features will not work. You can enable remote JMX with the following JVM command line option:

-Dcom.sun.management.jmxremote=true

If you need the JMX connection to be secured, refer to the Tomcat documentation on this topic.

windows:

set JAVA_OPTS=-Dcom.sun.management.jmxremote

Leosunny :

JAVA_OPTS=-Dcom.sun.management.jmxremote 
export JAVA_OPTS 

Put probe.war into webapps

Method1:Put probe.war into webapps

We can put psi-probe-web-3.0.0-20160603.023429-26.war into $CATALINA_HOME/webapps, and then we start tomcat.

Method2: Deploy probe on manager console after starting tomcat

http://127.0.0.1:8080/manager/html , input user and password

Monitor tomcat by probe

Click here:

We will to probe page monitoring.

Monitor data sources

<Resource name=”jdbc/test” auth=”Container”

type=”javax.sql.DataSource”

maxActive=”4″

minActive=”1″

maxIdle=”2″

maxWait=”10000″

username=”haohao”

password=”haohao”

driverClassName=”com.mysql.jdbc.Driver”

url=”jdbc:mysql://127.0.0.1:3306/test”

validationQuery=”SELECT 1″

testOnBorrow=”true” />

Problems

Problem1

http://127.0.0.1:8080/manager/html

Note: On Tomcat 5.x and 6.0.29 and below, you should use manager instead of manager-gui.

But we configure the privileges of user in $CATALINA_HOME/tomcat-users.xml as following, we use the tomcat version is apache-tomcat-7.0.69:

<tomcat-users>

<!– role of user –>

<role rolename=”manager”/>

<!– account of user –>

<user username=”admin” password=”admin” roles=”manager”/>

</tomcat-users>

So we re-configure the user and role like this:

example1: it is not working

<role rolename=”probeuser” />

<role rolename=”poweruser” />

<role rolename=”poweruserplus” />

<role rolename=”manager-gui” />

<user username=”admin” password=”admin” roles=”manager-gui” />

example2: it is not working

<role rolename=”tomcat”/>

<role rolename=”role1″/>

<role rolename=”manager-gui”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<role rolename=”poweruser”/>

<role rolename=”probeuser”/>

<user username=”tomcat” password=”tomcat” roles=”tomcat”/>

<user username=”both” password=”tomcat” roles=”tomcat,role1″/>

<user username=”role1″ password=”tomcat” roles=”role1″/>

<user username=”sss” password=”sss” roles=”manager-gui”/>

<user username=”admin” password=”admin” roles=”manager-script,manager-jmx,manager-status,poweruser,probeuser”/>

403 Forbidden

Install probe for tomcat on Leosunny

Configure user and parameter

[leosunny@linux01:conf]$cd //app/tomcat_payment/conf

[leosunny@linux01:conf]$ls

Catalina catalina.policy catalina.properties context.xml logging.properties server.xml tomcat-users.xml web.xml

[leosunny@linux01:conf]$tail tomcat-users.xml

<role rolename=”manager”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<user username=”admin” password=”admin” roles=”manager,manager-script,manager-jmx,manager-status”/

[leosunny@linux01:conf]$

[leosunny@linux01:bin]$pwd

//app/tomcat_payment/bin

[leosunny@linux01:bin]$more start.sh

#! /bin/bash

export JAVA_OPTS=”-Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -XX:PermSize=2048m -Dcom.sun.management.jmxremote”

export CATALINA_OPTS=”-Djava.awt.headless=true”

export CATALINA_PID=pid.txt

sh ./startup.sh

[leosunny@linux01:bin]$

Deploy probe

http://10.200.61.63:9150/

http://10.226.61.63:9150/manager/html

Problem1: java.lang.UnsupportedClassVersionError: psiprobe

tomcat version is 6.0.37

probe version: psi-probe-web-3.0.0-20160603.023429-26.war

But It is not worked by using this version.

SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/probe,J2EEApplication=none,J2EEServer=none

Jun 21, 2016 4:23:36 PM org.apache.catalina.startup.HostConfig deployWAR

SEVERE: Error deploying web application archive probe.war

java.lang.UnsupportedClassVersionError: psiprobe/AwtAppContextClassloaderListener : Unsupported major.minor version 51.0 (unable to load class psiprobe.AwtAppContextClassloaderListener)

at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2858)

at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)

at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)

at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)

at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)

at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)

at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4612)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)

at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:563)

at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1399)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

We need to use probe.1.7b.

Problem2: 403 Forbidden

You do not have sufficient privileges to access this page.

[leosunny@linux01:conf]$vi tomcat-users.xml

<tomcat-users>

<role rolename=”manager-gui”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<user username=”admin” password=”admin” roles=”manager-gui,manager-script,manager-jmx,manager-status”/>

</tomcat-users>

modify as following:

<role rolename=”manager”/>

<role rolename=”manager-script”/>

<role rolename=”manager-jmx”/>

<role rolename=”manager-status”/>

<user username=”admin” password=”admin” roles=”manager,manager-script,manager-jmx,manager-status”/>

Reference

About tomcat

http://www.open-open.com/lib/view/open1457673936234.html

http://wiki.jikexueyuan.com/project/tomcat/

http://www.iteye.com/topic/1122094

About probe

https://github.com/psi-probe/psi-probe/wiki/InstallationApacheTomcat

https://github.com/psi-probe/psi-probe/wiki/InstallationApacheTomcat

 

http://www.360doc.com/content/16/0220/17/16915_535995449.shtml

http://java-monitor.com/forum/install.php

http://daigong.iteye.com/blog/981218

http://cuisuqiang.iteye.com/blog/2072841

http://www.oschina.net/question/54100_31748

http://blog.csdn.net/a19881029/article/details/36662861

http://blog.csdn.net/jackyrongvip/article/details/5829457

https://github.com/psi-probe/psi-probe/issues/411V

Leave a Reply

Your email address will not be published. Required fields are marked *