1

For a project that I am currently embarking on, I am looking to read in text from a bunch of status pages of applications that are running within tomcat.

What I am trying to do is create a conglomerated status page that will show the status of the tomcat application (online/offline).

Up until now I've created a script that will parse the status pages of the applications and format the results into a table and then write the results to an html file; thus, creating a status page for all of my applications.

I've come to realize that every time I refresh the page, I am sending more and more GET requests to these sites and thus flooding the access logs of the tomcat applications.

What I'm looking for help with is a work around to parsing these status pages without spamming GET requests... OR, a way of disabling the GET flooding in the access logs.

Thank you!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Cameron Rosier
  • 223
  • 3
  • 15

2 Answers2

1

You did not tell how the status pages are created. But you could also get the applications states by querying JMX. Once enabled, you can get live data form your VMs. Using JMX's MBeans (which already exist for Tomcat) you could create a status page showing your applications on a single page, without parsing the former status pages and writing them to a database.

To check wether this is an opportunity, you can just start your server and open Java Mission Control (jmc.exe in your JDK's bin folder) and connect, by clicking MBean Server below the right process. Then in the MBean Browser (tab at the bottom) you will find something like Catalina or Tomcat (according to your Tomcats service name). In a subfolder, there is a type called WebModule, showing your installed applications. It should look like this:

enter image description here

You can query this data at any time, to create your own status page (i.e. in a controller).

Stefan
  • 12,108
  • 5
  • 47
  • 66
  • 1
    You can even create your own application MBeans and register them with the local MBean server. Same output method. See [Monitoring Apache Tomcat with JMX](http://tomcat.apache.org/presentations.html). – Christopher Schultz Feb 18 '18 at 04:15
0

I can think of may ways you can do this, like using SNMP

another easy way is to create a read only status page, which indicate if the service is up or not.

like that,

worker.list=jk-watch
worker.jk-watch.type=status
worker.jk-watch.read_only=true
worker.jk-watch.mount=/user/status/jk
worker.list=jk-manage
worker.jk-manage.type=status
worker.jk-manage.mount=/admin/status/jk