Apache Tomcat monitoring for Windows installations

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Apache Tomcat monitoring for Windows installations

Post by dlukinski »

We are unable to monitor Apache Tomcat installations done on Windows with XI Tomcat monitoring Wizard
- how to configure Windows installations to work with XI monitoring?

NCPA-based looks this way: UNKNOWN: An error occured connecting to API. (HTTP error: '500 INTERNAL SERVER ERROR')
- ver 2.3.1 / would it be urf8 problem with plans to be fixed only in NCPA 3?

JMX-based is as follows: UNKNOWN: Failed to connect: Failed to retrieve RMIServer stub: javax.naming.ConfigurationException [Root exception is java.rmi.UnknownHostException: Unknown host: XXXXXXXXX: nested exception is:
- seem to be the switch to the random port after the initial connection. Any way to deal with it?
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Apache Tomcat monitoring for Windows installations

Post by gsmith »

Hi

First check that the command has been updated with the correct path to java:
Image2.jpg
Next configure your service as:
Image1.jpg
where the arguments are:
$ARG1$:

Code: Select all

-s service:jmx:rmi:///jndi/rmi://192.168.23.82:9010/jmxrmi   -t tomcat -C 'MemorySimpleHeap,MemoryMetaspace,ProcessCPUUsage,SystemCPUUsage,Uptime' -w '17179869184,34359738368,50,70,1500000:' -c '32212254720,68719476736,70,90,300000:'
$ARG2$:

Code: Select all

.
On my system I had to create /usr/local/tomcat/bin/setenv.sh:

Code: Select all

CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.23.82"
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true "
And on the jmx host I had to open up port 9010 in the firewall.

Let me know how things turn out please.

Thanks
You do not have the required permissions to view the files attached to this post.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Apache Tomcat monitoring for Windows installations

Post by dlukinski »

We have discovered that Windows Apache does NOT keep communications over the initial port.
It switches to the random port.

Would like to have your opinion on the matter
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Apache Tomcat monitoring for Windows installations

Post by gsmith »

Hi,

I missed one of the java_opts you need.

On your Windows Tomcat server you need these options to java when launching Tomcat.

The easiest way to do that is from Start, Tomcat, Configure Tomcat. It must be
written to some file(s) but I didn't track them down right now.

Code: Select all

-Dcatalina.home=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5
-Dcatalina.base=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5
-Djava.io.tmpdir=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.5\conf\logging.properties
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.rmi.port=9010
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=192.168.23.96
-Djava.net.preferIPv4Stack=true 
-Djava.net.preferIPv4Addresses=true
Adding this second port parameter:
-Dcom.sun.management.jmxremote.rmi.port=9010

is what solves the random port issue.

Thanks
Locked