cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 7

JAVA APPLICATION SERVER MONITORING VIA SNMP ADDING JAVA_OPTS to CATALINA.BAT

Hi all,

I'm trying to supervise my Tomcat  7 application  using JAVA APPLICATION SERVER MONITORING VIA SNMP Template

Java Application Server monitoring via SNMP

I'm following the guide and it seems that I have to 2 Java parmeters in catalina.bat:

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.port=1161

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.interface=0.0.0.0

Tomcat doesn't start when I add  -Dcom.sun.management.snmp* to catalina, did someone try this doc before so he can tell me how can I configure that ?

Best Regards

Labels (1)
Tags (3)
3 Replies
Product Manager
Product Manager

From -> Configuring Java Virtual Machines for SNMP

Configuring Apache Tomcat (tested on version 7.0)

Windows Service

1.

Open Tomcat configuration: Start > All Programs > Apache Tomcat > Configure Tomcat.

2.

Open the Java tab, and then add the following lines to the Java Options box:
-Dcom.sun.management.snmp.port=1161
-Dcom.sun.management.snmp.interface=0.0.0.0

3.

Click Apply.

4.

Go to the Windows Services console.

5.

Right-click the Apache Tomcat service.

6.

Click Properties.

7.

Click the Log On tab, and then select Log on as this account.

8.

Click Browse, find the user “Administrator” and type the Administrator password twice.

9.

Click OK.

10.

In the Tomcat Configuration window, return to the General tab, and then start the service.

Windows Command Line

1.

Open the file %TOMCAT_HOME%\bin\catalina.bat and add the following lines into the Debug, Run and Start sections (where%TOMCAT_HOME% is the path to your Tomcat installation):

set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.port=1161"
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.interface=0.0.0.0"


:doDebug
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.port=1161"
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.interface=0.0.0.0"
shift

:doRun
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.port=1161"
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.interface=0.0.0.0"
shift

:doStart
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.port=1161"
set "JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.snmp.interface=0.0.0.0"
shift

2.

Run %TOMCAT_HOME%\bin\startup.bat to start Tomcat.

Linux

1.

Open $TOMCAT_HOME/bin/catalina.sh and then add the following lines into Debug, Run and Start sections (where%TOMCAT_HOME% is the path to your Tomcat installation):

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.port=1161"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.interface=0.0.0.0"


if [ "$1" = "debug" ] ; then
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.port=1161"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.interface=0.0.0.0"
if $os400; then

elif [ "$1" = "run" ]; then
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.port=1161"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.interface=0.0.0.0"
shift

elif [ "$1" = "start" ] ; then
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.port=1161"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.snmp.interface=0.0.0.0"
if [ ! -z "$CATALINA_PID" ]; then

2.

Run $TOMCAT_HOME/bin/startup.sh command to start Tomcat.

unable to find Debug, Run and Start sections into Catalina.sh.

0 Kudos

Thank you aLTeReGo its fixed and tested with Tomcat 7.

Also tested it on  Tomcat 6.0.32 and works fine, but components are not OK

error:

"SNMP monitor execution error. No such instance currently exists at this OID."


components are :


1/Thread Instant Blocked Count

OID:  1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.4.0.0.0.0.0.0.0.1

2/Thread Instant Blocked Time (ms)

OID: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.5.0.0.0.0.0.0.0.1

3/Thread Instant Wait CounT

OID: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.6.0.0.0.0.0.0.0.1

4/Thread Instant Wait Time (ms)

OID: 1.3.6.1.4.1.42.2.145.3.163.1.1.3.10.1.7.0.0.0.0.0.0.0.1



They are working fine in Tomcat 7 so I guess we need to reviw OIDs on Tomcat 6


Mohamed Ali Bechamki

Regards




0 Kudos