nlighten / tomcat_exporter

A Prometheus exporter for Apache Tomcat
Apache License 2.0
138 stars 64 forks source link

Can't see the metrics #40

Open mn519019 opened 2 years ago

mn519019 commented 2 years ago

Hi I am integrating Tomcat Exporter on one of my servers. I currently see such an error message.

Log message catalina:

22-Jun-2022 19:53:09.780 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '600' did not find a matching property. 22-Jun-2022 19:53:09.783 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '600' did not find a matching property. 22-Jun-2022 19:53:09.784 WARNING [main] org.apache.catalina.startup.SetAllPropertiesRule.begin [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'maxProcessors' to '600' did not find a matching property. 22-Jun-2022 19:53:09.796 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlValidation' to 'false' did not find a matching property. 22-Jun-2022 19:53:09.796 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'xmlNamespaceAware' to 'false' did not find a matching property. 22-Jun-2022 19:53:09.821 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'allowLinking' to 'true' did not find a matching property. 22-Jun-2022 19:53:09.829 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'allowLinking' to 'true' did not find a matching property. 22-Jun-2022 19:53:09.830 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'allowLinking' to 'true' did not find a matching property. 22-Jun-2022 19:53:09.840 WARNING [main] org.apache.tomcat.util.digester.SetPropertiesRule.begin [SetPropertiesRule]{Server/Service/Engine/Host/Valve} Setting property 'resolveHosts' to 'false' did not find a matching property. 22-Jun-2022 19:53:09.879 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 22-Jun-2022 19:53:09.889 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 22-Jun-2022 19:53:09.892 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8081"] 22-Jun-2022 19:53:09.892 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 22-Jun-2022 19:53:09.893 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8082"] 22-Jun-2022 19:53:09.893 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 22-Jun-2022 19:53:09.893 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 359 ms 22-Jun-2022 19:53:09.904 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 22-Jun-2022 19:53:09.904 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.15 22-Jun-2022 19:53:15.208 INFO [localhost-startStop-3] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 22-Jun-2022 19:53:15.224 INFO [localhost-startStop-2] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 22-Jun-2022 19:53:15.636 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 22-Jun-2022 19:53:16.473 INFO [localhost-startStop-4] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 22-Jun-2022 19:53:30.460 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 22-Jun-2022 19:53:30.474 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8081"] 22-Jun-2022 19:53:30.478 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8082"] 22-Jun-2022 19:53:30.482 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 20588 ms

lib

ls -la total 7828 drwxrwxr-x 2 release wibapp 4096 Jun 22 19:29 . drwxrwxr-x 9 release wibapp 4096 Jun 22 15:10 .. -rwxrwxr-x 1 release wibapp 18109 May 5 2017 annotations-api.jar -rwxrwxr-x 1 release wibapp 53135 May 5 2017 catalina-ant.jar -rwxrwxr-x 1 release wibapp 118638 May 5 2017 catalina-ha.jar -rwxrwxr-x 1 release wibapp 1606304 May 5 2017 catalina.jar -rwxrwxr-x 1 release wibapp 74734 May 5 2017 catalina-storeconfig.jar -rwxrwxr-x 1 release wibapp 269231 May 5 2017 catalina-tribes.jar -rwxrwxr-x 1 release wibapp 2450404 May 5 2017 ecj-4.6.3.jar -rwxrwxr-x 1 release wibapp 81439 May 5 2017 el-api.jar -rwxrwxr-x 1 release wibapp 163118 May 5 2017 jasper-el.jar -rwxrwxr-x 1 release wibapp 588785 May 5 2017 jasper.jar -rwxrwxr-x 1 release wibapp 26871 May 5 2017 jaspic-api.jar -rwxrwxr-x 1 release wibapp 61653 May 5 2017 jsp-api.jar -rwxrwxr-x 1 release wibapp 244064 May 5 2017 servlet-api.jar -rwxr-xr-x 1 root root 88558 Aug 29 2021 simpleclient-0.12.0.jar -rwxr-xr-x 1 root root 8007 Aug 29 2021 simpleclient_common-0.12.0.jar -rwxr-xr-x 1 root root 24093 Aug 29 2021 simpleclient_hotspot-0.12.0.jar -rwxr-xr-x 1 root root 87904 Aug 29 2021 simpleclient_servlet-0.12.0.jar -rwxr-xr-x 1 root root 12940 Aug 29 2021 simpleclient_servlet_common-0.12.0.jar -rwxrwxr-x 1 release wibapp 10557 May 5 2017 tomcat-api.jar -rwxrwxr-x 1 release wibapp 777109 May 5 2017 tomcat-coyote.jar -rwxrwxr-x 1 release wibapp 251070 May 5 2017 tomcat-dbcp.jar -rwxr-xr-x 1 root root 19586 Oct 31 2021 tomcat_exporter_client-0.0.15.jar -rwxrwxr-x 1 release wibapp 66795 May 5 2017 tomcat-i18n-es.jar -rwxrwxr-x 1 release wibapp 40719 May 5 2017 tomcat-i18n-fr.jar -rwxrwxr-x 1 release wibapp 42072 May 5 2017 tomcat-i18n-ja.jar -rwxrwxr-x 1 release wibapp 144317 May 5 2017 tomcat-jdbc.jar -rwxrwxr-x 1 release wibapp 33871 May 5 2017 tomcat-jni.jar -rwxrwxr-x 1 release wibapp 134645 May 5 2017 tomcat-util.jar -rwxrwxr-x 1 release wibapp 203782 May 5 2017 tomcat-util-scan.jar -rwxrwxr-x 1 release wibapp 209736 May 5 2017 tomcat-websocket.jar -rwxrwxr-x 1 release wibapp 36905 May 5 2017 websocket-api.jar

curl

curl http://localhost:8080/metrics/ <!doctype html>HTTP Status [404] – [Not Found]

HTTP Status [404] – [Not Found]

I am not certainly sure how to resolve this issue... do you have any advices..? It seems like catalina starts up but I do not see any metrics....

nlighten commented 2 years ago

Can you validate that there is a metrics.war in the webapps directory and that it is property deployed (e.g. is it visible in tomcat manager)?

omissis commented 2 years ago

Hi @nlighten, I am having a similar problem using Tomcat 10.0.27 (jdk8, jdk11, jdk17)

The war file is there, it seems to be deployed correctly, yet the endpoint is not accessible. It does work fine on Tomcat 9.0.68.

Is there any other info I can gather to debug the problem?

Thanks!

Screenshot from 2022-11-03 16-39-15 Screenshot from 2022-11-03 16-39-40 Screenshot from 2022-11-03 16-39-54 Screenshot from 2022-11-03 16-40-11

nlighten commented 2 years ago

Hi @omissis

The latest version of the exporter is build for Tomcat 9.x. Starting 10.x Tomcat is moving away from using the javax.* API to jakarta servlet. At minimum this would require a recompilation of the exporter. However, I currently have no plans to do this since, as indicated in the readme, I am planning to sunset support by the end of the year.

I haven't tested this, but you could try if the legacy support in Tomcat 10 works:

  1. create a folder webapps-javaee parallel to webapps folder
  2. copy metrics.war to this directory.
  3. delete the metrics.war and the inflated folder from webapps directory
omissis commented 2 years ago

swell, thanks @nlighten !

guillenotfound commented 1 year ago

On our end it seems to create metrics under webapps even if we put it at webapps-javaee, did the solution worked for you @omissis ?

omissis commented 1 year ago

@guillenotfound we moved away from this exporter and settled on jmx for all our tomcat 10.x images.