2

How can I monitor a tomcat server using JMX in remote nagios server ?

Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
khakishoiab
  • 9,673
  • 2
  • 16
  • 22

1 Answers1

1

Configuration for client:create setenv.sh file and do chmod 755 on file and copy it into /usr/share/tomcat7/bin/ or tomcat installation folder on your client machine.

Now copy these lines into it:

 CATALINA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=<unusedJmxPort> \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.rmi.port=9<same above port> \
-Djava.rmi.server.hostname= <public ip of this host>  \
-Djava.awt.headless=true -server"

Save this file and restart tomcat and make sure the jmx port specified above is open both inward and outward.

Configuration for Nagios machine: Go to the directory in which jmx plugin is installed i.e libexec and test the line below:

./check_jmx -U service:jmx:rmi:///jndi/rmi://<public ip of client>:<port specified on client>/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 10737418240 -c 20401094656

I have checked this with java 7.

Now you can declare the command and server configuration for the same in your respective configuration file on monitoring machine.Just make sure checkJmx plugin has root privileges.

khakishoiab
  • 9,673
  • 2
  • 16
  • 22